Skip to content

Commit d37510c

Browse files
author
Sylvestre Gug
committed
throwing not implemented instead of not found
1 parent b71e96b commit d37510c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/errors.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import {createError} from "micro";
22
export const unauthorized = (error) => createError(401, "Unauthorized", error);
33
export const notFound = (error) => createError(404, "Not Found", error);
4+
export const notImplemented = (error) =>
5+
createError(501, "Not Implemented", error);
46
export const badRequest = (error) =>
57
createError(400, typeof error === "string" ? error : "Bad request", error);
68
export const failedCheck = (error) =>

lib/mssql.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Ajv from "ajv";
22
import JSONStream from "JSONStream";
33
import {json} from "micro";
44
import mssql from "mssql";
5-
import {notFound, failedCheck, badRequest} from "./errors.js";
5+
import {failedCheck, badRequest, notImplemented} from "./errors.js";
66

77
const TYPES = mssql.TYPES;
88

@@ -161,7 +161,7 @@ export default (credentials) => async (req, res) => {
161161
return queryStream(req, res, pool);
162162
}
163163

164-
throw notFound();
164+
throw notImplemented();
165165
}
166166
};
167167

0 commit comments

Comments
 (0)