Skip to content

Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
Minds Backend - Engine
Minds Backend - Engine
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
    • Insights
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
    • Locked Files
  • Issues 241
    • Issues 241
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 33
    • Merge Requests 33
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Packages
    • Packages
    • List
    • Container Registry
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Minds
  • Minds Backend - EngineMinds Backend - Engine
  • Issues
  • #790

Closed
Open
Opened 48 minutes ago by Mark Harding@markeharding
  • Report abuse
  • New issue
Report abuse New issue

(discussion): The state of exceptions

  • When should exceptions be used?
  • Which exceptions should be considered friendly, and which ones system errors?
  • Which exceptions should be delivered to a user?

Minds\Core\Exceptions\ApiException

eg:

class InvalidMethod extends ApiException
{
    private $message = "This method is not allowed";
}

Minds\Core\Exceptions\UserException

Sentry should not catch these errors and the API should cleanly report the error message.

class InsufficientBalance extends UserException
{
    private $message = "You do not have enough tokens to fulfill this transaction";
}

Minds\Core\Exceptions\ApplicationException

Sentry should log, and the API may return a generic message.

class DatabaseException extends ApplicationException
{
    private $message = "The database couldn't be communicated with";
}

Minds\Core\Exceptions\Exception

Sentry should log, and the API should return a traceable error code.

class Exception extends \Exception
{
    private $message = "There was unknown error";
}

Please solve the reCAPTCHA

We want to be sure it is you, please confirm you are not a robot.

Edited 46 minutes ago by Mark Harding

Related issues
0

    • Discussion 2
    • Designs
    • Mark Harding @markeharding changed the description 2 times within 1 minute 46 minutes ago

      changed the description 2 times within 1 minute

    • Juan Manuel Solaro
      Juan Manuel Solaro @juanmsolaro · 14 minutes ago
      Developer

      I recently used InvalidParameterException when the user select a date older than 3 months for a scheduled activity. In my understanding, this is not the correct use of exceptions, since technically, it feel just like a sort of flow control. The same occurs to me, for instance, with InsufficientBalance extends UserException. Is this really an exception or just a scenario where the endpoint should inform something to the user that the operation couldn't be completed? For me, it resembles more to a normal endpoint response.

    • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
    Please register or sign in to reply
    0 Assignees
    None
    Assign to
    None
    Epic
    None
    None
    Milestone
    None
    Assign milestone
    None
    Time tracking
    No estimate or time spent
    None
    Due date
    None
    0
    Labels
    None
    Assign labels
    • View project labels
    None
    Weight
    None
    Confidentiality
    Not confidential
    Lock issue
    Unlocked
    2
    2 participants
    user avatar
    Juan Manuel Solaro
    user avatar
    Mark Harding
    Reference: minds/engine#790