File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -386,7 +386,7 @@ export const ManagerPlugin = {
386386 async refreshInstall ( name : string ) {
387387 const doc = await KVDBMain . get ( CommonConfig . dbSystem , `${ CommonConfig . dbPluginIdPrefix } /${ name } ` )
388388 if ( ! doc ) {
389- throw `PluginNotFound : ${ name } `
389+ throw `PluginNotExists : ${ name } `
390390 }
391391 const pluginInfo : PluginInfo = doc as any
392392 const root = pluginInfo . root
@@ -419,15 +419,15 @@ export const ManagerPlugin = {
419419 async uninstall ( name : string ) {
420420 const plugin = await this . get ( name )
421421 if ( ! plugin ) {
422- throw `PluginNotFound : ${ name } `
422+ throw `PluginNotExists:-1: ${ name } `
423423 }
424424 const pi = await KVDBMain . get ( CommonConfig . dbSystem , `${ CommonConfig . dbPluginIdPrefix } /${ name } ` )
425425 if ( ! pi ) {
426- throw `PluginNotFound : ${ name } `
426+ throw `PluginNotExists:-2: ${ name } `
427427 }
428428 const info : PluginInfo = pi as any
429429 if ( ! info . name || ! info . version || ! info . type || ! info . config ) {
430- throw `PluginNotFound : ${ name } `
430+ throw `PluginNotExists:-3: ${ name } `
431431 }
432432 await ManagerBackend . run ( plugin , 'hook' , 'beforeUninstall' , { } )
433433 if ( info . type === PluginType . STORE || info . type === PluginType . ZIP ) {
Original file line number Diff line number Diff line change @@ -100,6 +100,9 @@ export const ManagerPluginStore = {
100100 if ( ! configJson ) {
101101 throw 'PluginFormatError:-10'
102102 }
103+ if ( configJson [ 'name' ] !== pluginName ) {
104+ throw 'PluginFormatError:-11'
105+ }
103106 const payload = {
104107 plugin : pluginName ,
105108 version : option [ 'version' ] ,
@@ -197,15 +200,15 @@ export const ManagerPluginStore = {
197200 isFullPath : true ,
198201 } )
199202 if ( ! config ) {
200- throw 'PluginFormatError:-11 '
203+ throw 'PluginFormatError:-12 '
201204 }
202205 let configJson = null
203206 try {
204207 configJson = JSON . parse ( config )
205208 } catch ( e ) {
206209 }
207210 if ( ! configJson ) {
208- throw 'PluginFormatError:-12 '
211+ throw 'PluginFormatError:-13 '
209212 }
210213 const payload = {
211214 plugin : pluginName ,
Original file line number Diff line number Diff line change @@ -16,10 +16,14 @@ export function mapError(msg: any) {
1616 if ( msg . includes ( key ) ) {
1717 let error = map [ key ]
1818 // regex PluginReleaseDocFormatError:-11
19- const regex = new RegExp ( `${ key } :(-?\\d+)` )
19+ const regex = new RegExp ( `${ key } :(-?\\d+):?([\\w\\d]*) ` )
2020 const match = msg . match ( regex )
21+ console . log ( 'match' , match )
2122 if ( match ) {
2223 error += `(${ match [ 1 ] } )`
24+ if ( match [ 2 ] ) {
25+ error += `(${ match [ 2 ] } )`
26+ }
2327 }
2428 return error
2529 }
You can’t perform that action at this time.
0 commit comments