Commit 32c89681 authored by Lorex's avatar Lorex

feat: 新增請求失敗錯誤處理

parent cebd3e8d
/**
* Module dependencies
*/
var util = require('util');
var _ = require('@sailshq/lodash');
/**
* 400 (Bad Request) Handler
*
* Usage:
* return res.badRequest();
* return res.badRequest(data);
*
* e.g.:
* ```
* return res.badRequest(
* 'Please choose a valid `password` (6-12 characters)',
* 'trial/signup'
* );
* ```
*/
module.exports = function badRequest(data) {
// Get access to `req` and `res`
var req = this.req;
var res = this.res;
// Get access to `sails`
var sails = req._sails;
// Set status code
res.status(400);
return res.json({success: false, msg: `請求錯誤:${data.details}`});
};
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment