-
Notifications
You must be signed in to change notification settings - Fork 16
/
deno_http_errors.deno.txt
32 lines (23 loc) · 2.16 KB
/
deno_http_errors.deno.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
DENO_HTTP_ERRORS
ALTERNATIVES ==> #See http-errors
#Browser compatible
VERSION ==> #Part of Deno
std/http/http_errors.ts
new HttpError('MESSAGE'[, OPTS]) #Inherits from Error
HTTP_ERROR.status #STATUS_NUM (def: 500)
#HTTP status of error response
HTTP_ERROR|OPTS.headers #Same VAL as new Headers(VAL)
#Headers to send with the error response
HTTP_ERROR|OPTS.expose #BOOL (def: true if HTTP_ERROR.status is 4**)
#Hint whether some info like stack should be shown or not to client
new errors.HTTP_STATUS #Inherits from HttpError
(['MESSAGE'[, OPTS]]) #HTTP_STATUS is CamelCase, e.g. HTTPVersionNotSupported
#Sets:
# - HTTP_ERROR.status
# - def 'MESSAGE' with standard STR for that HTTP status
createHttpError
(HTTP_STATUS[, 'MESSAGE'[,OPTS]])
->HTTP_ERROR #Same as new errors.HTTP_STATUS(...)
isHttpError(VAL)->BOOL #Same as VAL instanceof HttpError