The Mask
The Mask

Reputation: 17427

rules to define an error code?

I'm working on a project in which I need to return error codes in case work failed. But which is the 'rule' for doing this?

For example:

if(tryDoUpload() == false) {
  //upload failed
 int UPLOAD_FAILED = 0x0;
}

see 0x0, is there a pattern to set this error code or can I set any?

I hope this is clear.

Upvotes: 1

Views: 1353

Answers (1)

Muad'Dib
Muad'Dib

Reputation: 29216

there is no standard set of error codes for you to use. you are free to make your own. that being said, error codes are not very user friendly. if you are using a piece of software what would YOU want to see: "upload failed, error code 0x00deadbeef" or "upload failed, a file with that name all ready exists." you should prefer to give the user meaningful error messages.

Upvotes: 6

Related Questions