Skip to content

Missing/inconsistent ParseException codes #180

Closed
@izimodo

Description

@izimodo

Looking at the code, it seems like SDK is using the code property of ParseException to represent many different things:

  1. libcurl's internal error codes
  2. HTTP status codes
  3. Parse REST API error codes
    I understand that these sets of values do not overlap (curl uses code values 0-99). But most of the time, SDK does not assign the exception code at all. This inconsistency makes writing exception handling code very hard, as your only option is to parse the exception message string in order to determine what exactly went wrong.
    This can be most notably seen in ParseUser class:
if (!$username) {
    throw new ParseException('Cannot log in user with an empty name');
}

According to http://docs.parseplatform.org/php/guide/#error-codes the above code should set exception code to 200:

if (!$username) {
    throw new ParseException('Cannot log in user with an empty name', 200);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions