All files / app/customer mapErrorMessage.ts

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 189x       5x   5x   1x     1x     3x      
export default function mapErrorMessage(
    error: any, // TODO: Export `RequestError`
    translate: (key: string) => string
): string {
    const type = error.body && error.body.type;
 
    switch (type) {
    case 'throttled_login':
        return translate('customer.sign_in_throttled_error');
 
    case 'reset_password_before_login':
        return translate('customer.reset_password_before_login_error');
 
    default:
        return translate('customer.sign_in_error');
    }
}