You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to make raising and handling exceptions/errors more user friendly. What this means is, that we shouldn't rely on ShouldNotHappenException quite as often, e.g. in Qossmic\Deptrac\Supportive\Console\Application::doRun a RuntimeException would probably make more sense. In any case, the exception should contain a message that is helpful to users of Deptrac, when it is thrown. In the example above a message like "Could not determine current working directory. Please check if any one of the parent directories does not have the readable or search mode set. See chmod for more information on modes and permissions.". While this is rather verbose, it will tell users what went wrong and guide them towards a solution, if possible.
For future extension authors it would be helpful to be able to catch any of our exceptions, which is why we have the ExceptionInterface. As far as I can tell, we already use this consistently, so I don't think we need to do anything here, but if we missed implementing the interface somewhere, we should add it. Similarly raising exceptions should be consistent, so all of our exceptions should use static factory methods like Qossmic\Deptrac\Supportive\File\Exception\FileCannotBeParsedAsYamlException::fromFilenameAndException. There are a few exceptions to this rule currently that need to be updated, e.g. Qossmic\Deptrac\Supportive\File\Exception\FileNotExistsException
Tasks
Clean up unused exceptions
Ensure all custom exceptions implement ExceptionInterface
Ensure all custom exceptions use a static factory method
Replace overly generic or vague exceptions with dedicated exceptions or better fitting ones, especially ShouldNotHappenException
Add helpful error messages to raised exception
Declare which exceptions are expected to be thrown using @throws in the doc block
The text was updated successfully, but these errors were encountered:
I would like to make raising and handling exceptions/errors more user friendly. What this means is, that we shouldn't rely on
ShouldNotHappenException
quite as often, e.g. inQossmic\Deptrac\Supportive\Console\Application::doRun
a RuntimeException would probably make more sense. In any case, the exception should contain a message that is helpful to users of Deptrac, when it is thrown. In the example above a message like "Could not determine current working directory. Please check if any one of the parent directories does not have the readable or search mode set. See chmod for more information on modes and permissions.". While this is rather verbose, it will tell users what went wrong and guide them towards a solution, if possible.For future extension authors it would be helpful to be able to catch any of our exceptions, which is why we have the ExceptionInterface. As far as I can tell, we already use this consistently, so I don't think we need to do anything here, but if we missed implementing the interface somewhere, we should add it. Similarly raising exceptions should be consistent, so all of our exceptions should use static factory methods like
Qossmic\Deptrac\Supportive\File\Exception\FileCannotBeParsedAsYamlException::fromFilenameAndException
. There are a few exceptions to this rule currently that need to be updated, e.g.Qossmic\Deptrac\Supportive\File\Exception\FileNotExistsException
Tasks
@throws
in the doc blockThe text was updated successfully, but these errors were encountered: