resourceExists property

bool get resourceExists

Indicates if the resource exists, even though the response was not found.

Example:

} on NotFoundException catch (ex) {
  if (! ex.resourceExists) {
    response.status = HttpStatus.notFound; // HTTP 404
    ...
  } else {
    response.status = HttpStatus.methodNotAllowed; // HTTP 405
    ...
    // Set Allow header in response.
    // See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405>
  }
  ...
}

Implementation

bool get resourceExists => found == foundResourceDoesNotSupportMethod;