Skip to content

Exception handling design #286

Open
Open
@lszczygielek

Description

@lszczygielek

I like this library, I'm trying to consume it in my project.
I have issue with exception handling. Maybe I don't understand how exceptions are design in library.

Nuget version 4.2.0.

I have a code like:

try
{
        // projectId not exists - server will return 404.
	var project = redmineManager.GetObject<Project>(projectId, null);
}
catch (Exception e)
{
	// actions
}

I thought that e will be an exception derived from RedmineException but it's not.

This is what exception I have:

Exception: Name = "WebException" FullName = "System.Net.WebException" Message = "An exception occurred during a WebClient request."
    InnerException:    Name = "NotFoundException" FullName = "Redmine.Net.Api.Exceptions.NotFoundException" Message = "Not Found"
        InnerException of InnerException: Name = "WebException" FullName = "System.Net.WebException" Message = "The remote server returned an error: (404) Not Found."

Is it right flow? In my code now I have to catch WebException and check InnerException. It shouldn't be RedmineException the most outer?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions