@open-norantec/utilities 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hono-util.class.js +6 -2
- package/package.json +1 -1
package/dist/hono-util.class.js
CHANGED
|
@@ -126,7 +126,7 @@ class HonoUtil {
|
|
|
126
126
|
query: c.req.query.bind(c.req),
|
|
127
127
|
queries: c.req.queries.bind(c.req),
|
|
128
128
|
};
|
|
129
|
-
const
|
|
129
|
+
const authenticateResult = yield attempt_util_class_1.AttemptUtil.execPromise((() => __awaiter(this, void 0, void 0, function* () {
|
|
130
130
|
let authenticationValue = null;
|
|
131
131
|
if (!Array.isArray(authenticationTypes) || authenticationTypes.length === 0) {
|
|
132
132
|
return {
|
|
@@ -150,7 +150,11 @@ class HonoUtil {
|
|
|
150
150
|
if (!(finalResult === null || finalResult === void 0 ? void 0 : finalResult.type))
|
|
151
151
|
throw new StatusError(401);
|
|
152
152
|
return { authenticationValue: finalResult.result, authentication: finalResult.type };
|
|
153
|
-
}))();
|
|
153
|
+
}))());
|
|
154
|
+
if (authenticateResult instanceof Error) {
|
|
155
|
+
return c.json({ error: authenticateResult.message }, authenticateResult instanceof StatusError ? authenticateResult.status : 400);
|
|
156
|
+
}
|
|
157
|
+
const { authentication, authenticationValue } = authenticateResult;
|
|
154
158
|
const rawOutput = yield attempt_util_class_1.AttemptUtil.execPromise(handler(Object.assign({ input, authentication: authentication, authenticationValue }, baseContext)));
|
|
155
159
|
if (rawOutput instanceof Error) {
|
|
156
160
|
console.log('Handler error', rawOutput, rawOutput === null || rawOutput === void 0 ? void 0 : rawOutput.message, rawOutput === null || rawOutput === void 0 ? void 0 : rawOutput.stack);
|