ahmadandika

error message

May 6th, 2020
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* eslint-disable consistent-return */
  2. export const decodeError = (message, lang) => {
  3.   if (lang === 'id') {
  4.     switch (message) {
  5.       case 'internal server error':
  6.         return 'Terjadi kesalahan pada server';
  7.  
  8.       case 'Invalid user status':
  9.         return 'Status user tidak valid';
  10.  
  11.       case 'too_many_request':
  12.         return 'Request telah mencapai batas maksimal untuk hari ini';
  13.  
  14.       case 'invalid_body':
  15.         return 'Silahkan isi kolom yang masih kosong';
  16.  
  17.       case 'country_code_not_exist':
  18.         return 'Kode negara tidak ditemukan';
  19.  
  20.       case 'invalid_phone_length':
  21.         return 'Panjang nomor telepon tidak valid';
  22.  
  23.       case 'invalid_phone_format':
  24.         return 'Format nomor telepon tidak valid';
  25.  
  26.       case 'phone_too_much':
  27.         return 'Nomor telah mencapai batas maksimal pendaftaran';
  28.  
  29.       case 'email_exist':
  30.         return 'Email telah terdaftar';
  31.  
  32.       case 'db_submit':
  33.         return 'Kesalahan saat mengirim ke Database';
  34.  
  35.       case 'otp':
  36.         return 'Gagal menghasilkan OTP';
  37.  
  38.       case 'jwt':
  39.         return 'Gagal menghasilkan JWT';
  40.  
  41.       case 'send_sms':
  42.         return 'Gagal mengirim SMS';
  43.  
  44.       case 'record_not_exist':
  45.         return 'Data tidak ditemukan';
  46.  
  47.       case 'same_phone':
  48.         return 'Nomor telepon yang anda masukkan sama';
  49.  
  50.       case 'db_update':
  51.         return 'Kesalahan saat memperbarui ke Database';
  52.  
  53.       case 'exp_otp':
  54.         return 'OTP telah kadaluarsa';
  55.  
  56.       case 'wrong_otp':
  57.         return 'OTP salah';
  58.  
  59.       case 'activation_mail':
  60.         return 'Gagal mengirim email aktivasi';
  61.  
  62.       case 'invalid_email_key':
  63.         return 'Key aktivasi salah atau sudah kadaluarsa';
  64.  
  65.       case 'send_mail':
  66.         return 'Gagal mengirim email aktivasi';
  67.  
  68.       case 'same_email':
  69.         return 'Email yang anda masukkan sama';
  70.  
  71.       case 'user_not_found':
  72.         return 'Email / Password salah';
  73.  
  74.       case 'file_too_big':
  75.         return 'Ukuran file terlalu besar';
  76.  
  77.       case 'invalid_file_type':
  78.         return 'Tipe file tidak valid';
  79.  
  80.       case 'file_error':
  81.         return 'Gagal membaca file';
  82.  
  83.       case 'upload_file_error':
  84.         return 'Gagal mengunggah file';
  85.  
  86.       case 'invalid_identity_image':
  87.         return 'Gagal menemukan foto KTP';
  88.  
  89.       case 'invalid_ocr':
  90.         return 'NIK Tidak Cocok dengan foto e-KTP';
  91.  
  92.       case 'invalid_selfie_image':
  93.         return 'Gagal menemukan foto selfie KTP';
  94.  
  95.       case 'invalid_face_recognition':
  96.         return 'Foto selfie tidak cocok dengan foto pada KTP';
  97.  
  98.       case 'gender_not_found':
  99.         return 'Jenis kelamin tidak ditemukan';
  100.  
  101.       case 'get_dukcapil_data':
  102.         return 'Gagal mendapatkan data dari Dukcapil';
  103.  
  104.       case 'empty_dukcapil_data':
  105.         return 'Data dari Dukcapil tidak ditemukan';
  106.  
  107.       case 'invalid_name':
  108.         return 'Nama yang Anda Pilih Tidak Sesuai';
  109.  
  110.       case 'max_detail':
  111.         return 'Maksimal 3 detail';
  112.  
  113.       case 'invalid_signature_image':
  114.         return 'Gagal menemukan spesimen tanda tangan';
  115.  
  116.       case 'invalid_npwp_image':
  117.         return 'Gagal menemukan foto NPWP';
  118.  
  119.       case 'invalid_npwp_ocr':
  120.         return 'Nomor NPWP Tidak Cocok dengan Foto NPWP';
  121.  
  122.       case 'country_tax_detail':
  123.         return 'Negara tidak valid';
  124.  
  125.       case 'ba_format':
  126.         return 'Format nomor rekening tidak valid';
  127.  
  128.       case 'mailing_address_type':
  129.         return 'Alamat surat-menyurat tidak valid';
  130.  
  131.       case 'job_start_at':
  132.         return 'Tanggal mulai bekerja tidak relevan';
  133.  
  134.       case 'invalid_birth_date':
  135.         return 'Format tanggal lahir tidak valid';
  136.  
  137.       case 'dukcapil_complete':
  138.         return 'Data dukcapil sudah lengkap';
  139.  
  140.       case 'fill_all_data':
  141.         return 'Silahkan isi semua data secara lengkap';
  142.  
  143.       case 'connection_error':
  144.         return 'Koneksi gagal';
  145.  
  146.       case 'password_length':
  147.         return 'Panjang password harus 6 hingga 10 karakter';
  148.  
  149.       case 'password_format':
  150.         return 'Password harus terdiri dari minimal 3 kriteria berikut: huruf besar, huruf kecil, angka, dan simbol';
  151.  
  152.       case 'user_locked':
  153.         return 'Akun terkunci';
  154.  
  155.       case 'invalid_phone_region_length':
  156.         return 'Panjang kode area tidak valid';
  157.  
  158.       case 'npwp_format':
  159.         return 'Format nomor NPWP tidak valid';
  160.  
  161.       case 'redirect_to_login':
  162.         return 'Email sudah terdaftar';
  163.  
  164.       case 'recaptcha':
  165.         return 'Kesalahan pada recaptcha';
  166.  
  167.       case 'plafond_too_small':
  168.         return 'Jumlah plafond terlalu rendah';
  169.  
  170.       case 'plafond_too_big':
  171.         return 'Jumlah plafond terlalu tinggi';
  172.  
  173.       case 'invalid_spouse_name':
  174.         return 'Nama pasangan belum diisi';
  175.  
  176.       case 'invalid_spouse_phone':
  177.         return 'Nomor ponsel pasangan belum diisi';
  178.  
  179.       case 'invalid_spouse_email':
  180.         return 'Email pasangan belum diisi';
  181.  
  182.       case 'unfinished_application':
  183.         return 'Unfinished Application';
  184.  
  185.       case 'note_already_filled':
  186.         return 'Note Already Filled';
  187.  
  188.       case 'invalid_status':
  189.         return 'Invalid Status';
  190.  
  191.       case 'margin_confirmation_mail':
  192.         return 'Margin Confirmation Mail';
  193.  
  194.       case 'spouse_email_same_with_user':
  195.         return 'Anda tidak dapat menggunakan <i>e-mail</i> yang sama';
  196.  
  197.       case 'max_spouse_rejected':
  198.         return 'Pengajuan Anda telah ditolak pasangan Anda sebanyak 2x';
  199.  
  200.       case 'invalid_image_type':
  201.         return 'Invalid image type';
  202.  
  203.       case 'repair_user_data_mail':
  204.         return 'Repair User Data';
  205.  
  206.       case 'Not found repair data':
  207.         return 'Review Data Admin ';
  208.  
  209.       case 'phone_email_exist':
  210.         return 'Phone Email Exist';
  211.  
  212.       case 'privy_already_registered':
  213.         return 'Privy Already Registered';
  214.  
  215.       case 'code_exist':
  216.         return 'Privy Already Registered';
  217.  
  218.       case 'default_partner_exist':
  219.         return 'Default Partner Exist';
  220.  
  221.       case 'already_submit_margin':
  222.         return 'Already Submit Margin';
  223.  
  224.       default:
  225.         return 'Maaf, sedang ada kendala teknis pada sistem';
  226.     }
  227.   } else if (lang === 'en') {
  228.     switch (message) {
  229.       case 'internal server error':
  230.         return 'Internal server error';
  231.  
  232.       case 'Invalid user status':
  233.         return 'Invalid user status';
  234.  
  235.       case 'too_many_request':
  236.         return 'Too many request for today';
  237.  
  238.       case 'invalid_body':
  239.         return 'Please fill the empty field';
  240.  
  241.       case 'country_code_not_exist':
  242.         return 'Country code not exist';
  243.  
  244.       case 'invalid_phone_length':
  245.         return 'Invalid phone length';
  246.  
  247.       case 'invalid_phone_format':
  248.         return 'Invalid phone format';
  249.  
  250.       case 'phone_too_much':
  251.         return 'Too much duplication on phone number';
  252.  
  253.       case 'email_exist':
  254.         return 'Email already registered';
  255.  
  256.       case 'db_submit':
  257.         return 'Error on submitting to Database';
  258.  
  259.       case 'otp':
  260.         return 'Fail to generate OTP';
  261.  
  262.       case 'jwt':
  263.         return 'Fail to generate JWT';
  264.  
  265.       case 'send_sms':
  266.         return 'Fail to send SMS';
  267.  
  268.       case 'record_not_exist':
  269.         return 'Record does not exist';
  270.  
  271.       case 'same_phone':
  272.         return 'New phone same with the old one';
  273.  
  274.       case 'db_update':
  275.         return 'Error on updating to Database';
  276.  
  277.       case 'exp_otp':
  278.         return 'OTP already expired';
  279.  
  280.       case 'wrong_otp':
  281.         return 'Wrong OTP';
  282.  
  283.       case 'activation_mail':
  284.         return 'Send activation email failed';
  285.  
  286.       case 'invalid_email_key':
  287.         return 'Wrong activation key or already expired';
  288.  
  289.       case 'send_mail':
  290.         return 'Send activation email failed';
  291.  
  292.       case 'same_email':
  293.         return 'New email same with the old one';
  294.  
  295.       case 'user_not_found':
  296.         return 'Invalid Email / Password';
  297.  
  298.       case 'file_too_big':
  299.         return 'File size too big';
  300.  
  301.       case 'invalid_file_type':
  302.         return 'invalid file type';
  303.  
  304.       case 'file_error':
  305.         return 'Read file error';
  306.  
  307.       case 'upload_file_error':
  308.         return 'Upload file error';
  309.  
  310.       case 'invalid_identity_image':
  311.         return 'Invalid identity image';
  312.  
  313.       case 'invalid_ocr':
  314.         return 'Identity number different with uploaded image';
  315.  
  316.       case 'invalid_selfie_image':
  317.         return 'Invalid selfie image';
  318.  
  319.       case 'invalid_face_recognition':
  320.         return 'Profile and identity photo is not identical';
  321.  
  322.       case 'gender_not_found':
  323.         return 'Gender not found';
  324.  
  325.       case 'get_dukcapil_data':
  326.         return 'Get Dukcapil data failed';
  327.  
  328.       case 'empty_dukcapil_data':
  329.         return 'Empty Dukcapil data';
  330.  
  331.       case 'invalid_name':
  332.         return 'Incorrect answer';
  333.  
  334.       case 'max_detail':
  335.         return 'Maximum 3 detail can be recorded';
  336.  
  337.       case 'invalid_signature_image':
  338.         return 'Invalid signature image';
  339.  
  340.       case 'invalid_npwp_image':
  341.         return 'invalid NPWP image';
  342.  
  343.       case 'invalid_npwp_ocr':
  344.         return 'NPWP number different with uploaded image';
  345.  
  346.       case 'country_tax_detail':
  347.         return 'Invalid country on tax detail';
  348.  
  349.       case 'ba_format':
  350.         return 'Invalid bank account format';
  351.  
  352.       case 'mailing_address_type':
  353.         return 'Invalid mailing address type';
  354.  
  355.       case 'job_start_at':
  356.         return 'Invalid date job start at';
  357.  
  358.       case 'invalid_birth_date':
  359.         return 'invalid birthdate';
  360.  
  361.       case 'dukcapil_complete':
  362.         return 'All Dukcapil data already completed';
  363.  
  364.       case 'fill_all_data':
  365.         return 'Please fill all your data first';
  366.  
  367.       case 'connection_error':
  368.         return 'Connection error';
  369.  
  370.       case 'password_length':
  371.         return 'password length must be 6 to 10 characters';
  372.  
  373.       case 'password_format':
  374.         return 'Password must includes at least 3 criterias of : uppercase letters, lowercase letters, numbers, and symbols';
  375.  
  376.       case 'user_locked':
  377.         return 'Account locked';
  378.  
  379.       case 'invalid_phone_region_length':
  380.         return 'Invalid phone region length';
  381.  
  382.       case 'npwp_format':
  383.         return 'Invalid NPWP number';
  384.  
  385.       case 'redirect_to_login':
  386.         return 'Email already registered';
  387.  
  388.       case 'recaptcha':
  389.         return 'Recapthca Error';
  390.  
  391.       case 'plafond_too_small':
  392.         return 'Plafond too small';
  393.  
  394.       case 'plafond_too_big':
  395.         return 'Plafond too big';
  396.  
  397.       case 'invalid_spouse_name':
  398.         return 'Spouse name required';
  399.  
  400.       case 'invalid_spouse_phone':
  401.         return 'Spouse phone required';
  402.  
  403.       case 'invalid_spouse_email':
  404.         return 'Spouse Email required';
  405.  
  406.       case 'invalid_spouse_name':
  407.         return 'Nama pasangan belum diisi';
  408.  
  409.       case 'invalid_spouse_phone':
  410.         return 'Nomor ponsel pasangan belum diisi';
  411.  
  412.       case 'invalid_spouse_email':
  413.         return 'Email pasangan belum diisi';
  414.  
  415.       case 'unfinished_application':
  416.         return 'Unfinished Application';
  417.  
  418.       case 'note_already_filled':
  419.         return 'Note Already Filled';
  420.  
  421.       case 'invalid_status':
  422.         return 'Invalid Status';
  423.  
  424.       case 'margin_confirmation_mail':
  425.         return 'Margin Confirmation Mail';
  426.  
  427.       case 'spouse_email_same_with_user':
  428.         return 'Spouse email same with user';
  429.  
  430.       case 'max_spouse_rejected':
  431.         return 'Max spouse rejected';
  432.  
  433.       case 'invalid_image_type':
  434.         return 'Invalid image type';
  435.  
  436.       case 'repair_user_data_mail':
  437.         return 'Repair User Data';
  438.  
  439.       case 'Not found repair data':
  440.         return 'Review Data Admin ';
  441.  
  442.       case 'phone_email_exist':
  443.         return 'Phone Email Exist';
  444.  
  445.       case 'privy_already_registered':
  446.         return 'Privy Already Registered';
  447.  
  448.       case 'code_exist':
  449.         return 'Privy Already Registered';
  450.  
  451.       case 'default_partner_exist':
  452.         return 'Default Partner Exist';
  453.  
  454.       case 'already_submit_margin':
  455.         return 'Already Submit Margin';
  456.  
  457.       default:
  458.         return 'Sorry, there are some technical problems';
  459.     }
  460.   }
  461. };
Add Comment
Please, Sign In to add comment