aiostreams / packages /addon /src /responses.ts
f4b404's picture
Sync from GitHub via hub-sync
4345f70 verified
Raw
History Blame Contribute Delete
657 Bytes
import { Settings } from '@aiostreams/utils';
export const errorResponse = (
errorMessage: string,
origin?: string,
path?: string,
externalUrl?: string
) => {
return {
streams: [errorStream(errorMessage, origin, path, externalUrl)],
};
};
export const errorStream = (
errorMessage: string,
errorTitle?: string,
origin?: string,
path?: string,
externalUrl?: string
) => {
return {
externalUrl:
(origin && path ? origin + path : undefined) ||
externalUrl ||
'https://github.com/Viren070/AIOStreams',
name: `[❌] ${Settings.ADDON_NAME}\n${errorTitle || 'Error'}`,
description: errorMessage,
};
};