Commit ·
7948322
1
Parent(s): b0ac1c0
插件抛出详细错误
Browse files
ndcc/server/lib/basic.js
CHANGED
|
@@ -114,7 +114,9 @@ module.exports = class{
|
|
| 114 |
request:this.request
|
| 115 |
}
|
| 116 |
});
|
| 117 |
-
if(statusMessage !== 'OK'){
|
|
|
|
|
|
|
| 118 |
const res = ()=>{ try { return JSON.parse(result) } catch (error) { return result; } };
|
| 119 |
config[item].data = res();
|
| 120 |
};
|
|
|
|
| 114 |
request:this.request
|
| 115 |
}
|
| 116 |
});
|
| 117 |
+
if(statusMessage !== 'OK'){
|
| 118 |
+
throw Boom.badRequest(`${item} plugins is error! Please check!`);
|
| 119 |
+
}else{
|
| 120 |
const res = ()=>{ try { return JSON.parse(result) } catch (error) { return result; } };
|
| 121 |
config[item].data = res();
|
| 122 |
};
|
ndcc/server/plugins/route.js
CHANGED
|
@@ -54,7 +54,7 @@ exports.plugin = {
|
|
| 54 |
return await nextHandlerWrapper(request,h);
|
| 55 |
}
|
| 56 |
} catch (e) {
|
| 57 |
-
Error(e)
|
| 58 |
}
|
| 59 |
}
|
| 60 |
}
|
|
|
|
| 54 |
return await nextHandlerWrapper(request,h);
|
| 55 |
}
|
| 56 |
} catch (e) {
|
| 57 |
+
Error(e.message,'plugins')
|
| 58 |
}
|
| 59 |
}
|
| 60 |
}
|
src/pages/api/plugins/Zi34RUP5T5YuGLrJ.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
| 3 |
export default async (req)=>{
|
| 4 |
const {send,reply,error,isGet,db,cookie,event,socket} = await req.ctx();
|
| 5 |
try{
|
|
|
|
| 6 |
send(await db('test').findOne())
|
| 7 |
}catch (e){
|
| 8 |
error(e)
|
|
|
|
| 3 |
export default async (req)=>{
|
| 4 |
const {send,reply,error,isGet,db,cookie,event,socket} = await req.ctx();
|
| 5 |
try{
|
| 6 |
+
error('fsdf')
|
| 7 |
send(await db('test').findOne())
|
| 8 |
}catch (e){
|
| 9 |
error(e)
|