Skip to content

Comments

Changed server response handling from NSException to NSError#54

Merged
cnstoll merged 4 commits intomutualmobile:masterfrom
jhilts:master
Apr 2, 2014
Merged

Changed server response handling from NSException to NSError#54
cnstoll merged 4 commits intomutualmobile:masterfrom
jhilts:master

Conversation

@jhilts
Copy link
Contributor

@jhilts jhilts commented Apr 1, 2014

If the server were to return something unexpected, it is often recoverable; as an NSException the app would simply crash.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion will only get triggered in DEBUG builds, so I don't think this is a terrible thing to do. However, I could be sold on having an error condition as a better way to handle this. An error is also more consistent with the way the rest of the library works.

@jhilts
Copy link
Contributor Author

jhilts commented Apr 1, 2014

That's fair, I will update the header ASAP. Thanks!

@cnstoll cnstoll added this to the 1.3.1 milestone Apr 1, 2014
@jhilts
Copy link
Contributor Author

jhilts commented Apr 1, 2014

The already-defined MMRecordErrorCodeInvalidResponseFormat seems applicable to this case, do you agree?

@cnstoll
Copy link
Contributor

cnstoll commented Apr 1, 2014

Yeah I think so too 👍

@jhilts
Copy link
Contributor Author

jhilts commented Apr 1, 2014

Please let me know if there are any other recommended changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subtle point, but MMRecord.m technically doesn't know anything about the AFResponseSerializer. Lets change this string to:

"The server response was in an unexpected format that could not be handled by MMRecord."

@jhilts
Copy link
Contributor Author

jhilts commented Apr 1, 2014

Done!

@cnstoll
Copy link
Contributor

cnstoll commented Apr 2, 2014

Hehe, good catch Brian. I did not notice the encompassing () around the or clause, hence the confusion.

cnstoll added a commit that referenced this pull request Apr 2, 2014
Changed server response handling from NSException to NSError
@cnstoll cnstoll merged commit 113e191 into mutualmobile:master Apr 2, 2014
@cnstoll
Copy link
Contributor

cnstoll commented Apr 2, 2014

Merged. Thanks Jeremy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants