Improves error handling and assertions on result-object.