import { b as ComponentErrorCodes } from './Plaid-DxSkT8pY.js';

// Errors on [capital]/config/locales/en.yml
// Add more errors as needed
const API_ERRORS = {
    NOT_AUTHENTICATED: 'not_authenticated',
    INVALID_PARAMETER: 'invalid_parameter',
};

const getErrorMessage = (error) => {
    if (typeof error === 'string') {
        return error;
    }
    return error.message;
};
const getErrorCode = (code) => {
    switch (code) {
        case API_ERRORS.NOT_AUTHENTICATED:
            return ComponentErrorCodes.NOT_AUTHENTICATED;
        case API_ERRORS.INVALID_PARAMETER:
            return ComponentErrorCodes.INVALID_PARAMETER;
        // add more cases as needed
        default:
            return ComponentErrorCodes.FETCH_ERROR;
    }
};

export { getErrorMessage as a, getErrorCode as g };
