Best way to define error codes/strings in Java?

前端 未结 13 792
别那么骄傲
别那么骄傲 2020-12-12 08:37

I am writing a web service in Java, and I am trying to figure out the best way to define error codes and their associated error strings. I need to have a nu

13条回答
  •  旧时难觅i
    2020-12-12 09:22

    I use PropertyResourceBundle to define the error codes in an enterprise application to manage locale error code resources. This is the best way to handle error codes instead of writing code (may be hold good for few error codes) when the number of error codes are huge and structured.

    Look at java doc for more information on PropertyResourceBundle

提交回复
热议问题