auth-node: tweaked some error types

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-08-11 16:27:24 +02:00
parent 02ea2388d6
commit f5eff800fd
2 changed files with 5 additions and 3 deletions
@@ -25,6 +25,7 @@ import {
} from '../types';
import { ProxyAuthenticator } from './types';
import { prepareBackstageIdentityResponse } from '../identity';
import { NotImplementedError } from '@backstage/errors';
/** @public */
export interface ProxyAuthRouteHandlersOptions<TResult> {
@@ -47,11 +48,11 @@ export function createProxyAuthRouteHandlers<TResult>(
return {
async start(): Promise<void> {
throw new Error('Not implemented');
throw new NotImplementedError('Not implemented');
},
async frameHandler(): Promise<void> {
throw new Error('Not implemented');
throw new NotImplementedError('Not implemented');
},
async refresh(this: never, req: Request, res: Response): Promise<void> {
@@ -18,6 +18,7 @@ import { ZodSchema, ZodTypeDef } from 'zod';
import { SignInResolver } from '../types';
import zodToJsonSchema from 'zod-to-json-schema';
import { JsonObject } from '@backstage/types';
import { InputError } from '@backstage/errors';
/** @public */
export interface SignInResolverFactory<TAuthResult, TOptions> {
@@ -55,7 +56,7 @@ export function createSignInResolverFactory<
if (!optionsSchema) {
return (resolverOptions?: TOptionsInput) => {
if (resolverOptions) {
throw new Error('sign-in resolver does not accept options');
throw new InputError('sign-in resolver does not accept options');
}
return options.create(undefined as TOptionsOutput);
};