remix-nlux
Version:
Remix IDE NLUX integration. Remix IDE is the leading IDE for building and deploying smart contracts on Ethereum. NLUX is a JavaScript and React library for building conversational AI experiences.
20 lines (16 loc) • 625 B
text/typescript
import {NLErrorId} from '@shared/types/exceptions/errors';
export const adapterErrorToExceptionId = (error: unknown): NLErrorId | null => {
if (typeof error === 'object' && error !== null) {
const errorAsObject = error as Record<string, unknown>;
if (errorAsObject.code === 'invalid_api_key') {
return 'invalid-api-key';
}
if (
errorAsObject.message && typeof errorAsObject.message === 'string' &&
errorAsObject.message.toLowerCase().includes('connection error')
) {
return 'connection-error';
}
}
return null;
};