Implement a command-line interface to the running webserver, and a way to get/set...
[ndcode_site.git] / _config / Problem.mjs
1 let Problem = class {
2   constructor(title, detail, status) {
3     this.title = title
4     this.detail = detail
5     this.status = status
6   }
7
8   static from(error) {
9     return (
10       error instanceof Problem ?
11         error :
12         new Problem('Bad request', error.message, 400)
13     )
14   }
15 }
16
17 export default Problem