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.
17 lines (13 loc) • 523 B
text/typescript
import {NLErrorId} from '@shared/types/exceptions/errors';
export const adapterErrorToExceptionId = (error: unknown): NLErrorId | null => {
if (typeof error === 'object' && error !== null) {
const typedError = error as {code?: string; message?: string};
if (typedError.code === 'invalid_api_key') {
return 'invalid-api-key';
}
if (typedError.message?.toLowerCase().includes('connection error')) {
return 'connection-error';
}
}
return null;
};