Project maintenance: ensure all error codes are available at one place

Issue #23 resolved
Daníel Sigurgeirsson created an issue

So, instead of doing this:

throw new SomethingException("INVALID_STUDENT_ID");

we should be doing this:

throw new SomethingException(ErrorCodes.INVALID_STUDENT_ID);

with the class ErrorCodes defined like this:

class ErrorCodes
{
    public const string INVALID_STUDENT_ID = "INVALID_STUDENT_ID";
    // Etc., put other error codes in here as well...
}

This ensures that we reuse codes as much as possible.

Comments (2)

  1. Log in to comment