Hipo/hipo-exceptions-js

Should we consider converting `snake_case` strings into `Capital Case`?

Closed this issue · 1 comments

Here I display lot_size: Lot size must be larger than test size. using generateErrorMessage function but I think it would be more meaningful for users if we display it as Lot Size: Lot size must be larger than test size.

Ekran Resmi 2020-09-22 16 09 06

Also, after our chat, we decided that it would be a nice improvement if we pass an object as fieldLabelMap to options of generateErrorMessage. This object will be used to parse the error key.

e.g.
After passing the object below,

const fieldLabelMap = {lot_size: "An unrelated name I want", test_size: "Another unrelated name"};

the returned value from generateErrorMessage will be An unrelated name I want: Lot size must be larger than test size. instead of Lot Size: Lot size must be larger than test size.

See the explanation here