Fix let-bug in Resources.unref() caught by ES6 (another was fixed previously)
[jst_server.git] / Problem.mjs
1 class Problem {
2   constructor(title, detail, status) {
3     this.title = title
4     this.detail = detail
5     this.status = status
6   }
7
8   // note: Javascript errors return status 400 (Bad request) in the client
9   // version of Problem, 500 (Internal server error) in the server version
10   static from(error) {
11     return (
12       error instanceof Problem ?
13         error :
14         new Problem(
15           'Internal server error',
16           (error.stack || error.message),
17           500
18         )
19     )
20   }
21 }
22
23 export default Problem