-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adopt the exception unification changes #3194
Conversation
@@ -25,7 +25,7 @@ | |||
{ | |||
internal RealmClassLacksPrimaryKeyException(string message) : base(message) | |||
{ | |||
HelpLink = "https://docs.mongodb.com/realm/dotnet/objects/#primary-key"; | |||
HelpLink = "https://www.mongodb.com/docs/realm/sdk/dotnet/model-data/define-object-model/#primary-key"; |
Check warning
Code scanning / CodeQL
Virtual call in constructor or destructor
@@ -25,7 +25,7 @@ | |||
{ | |||
internal RealmDuplicatePrimaryKeyValueException(string message) : base(message) | |||
{ | |||
HelpLink = "https://docs.mongodb.com/realm/dotnet/objects/#primary-key"; | |||
HelpLink = "https://www.mongodb.com/docs/realm/sdk/dotnet/model-data/define-object-model/#primary-key"; |
Check warning
Code scanning / CodeQL
Virtual call in constructor or destructor
@@ -623,7 +623,7 @@ | |||
|
|||
public ObjectHandle CreateObject(TableKey tableKey) | |||
{ | |||
var result = NativeMethods.create_object(this, tableKey.Value, out NativeException ex); | |||
var result = NativeMethods.create_object(this, tableKey.Value, out var ex); |
Check notice
Code scanning / CodeQL
Calls to unmanaged code
Pull Request Test Coverage Report for Build 4284488053
💛 - Coveralls |
RLM_ERR_CALLBACK = 1000000, | ||
RLM_ERR_UNKNOWN = 2000000, | ||
|
||
RowDetached = 1000004000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why these don't have the same casing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RLM_ERR...
ones are coming from Core. The PascalCased ones are custom codes that we define. I'll add a comment to make sure it's clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I like the added round tripping of client reset managed exceptions.
if (value.is_null() && !is_nullable(dict.get_type())) { | ||
throw NotNullable("Attempted to add null to a dictionary of required values"); | ||
} | ||
|
||
if (!value.is_null() && dict.get_type() != PropertyType::Mixed && to_capi(dict.get_type()) != value.type) { | ||
throw PropertyTypeMismatchException(to_string(dict.get_type()), to_string(value.type)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (value.is_null() && !is_nullable(dict.get_type())) { | |
throw NotNullable("Attempted to add null to a dictionary of required values"); | |
} | |
if (!value.is_null() && dict.get_type() != PropertyType::Mixed && to_capi(dict.get_type()) != value.type) { | |
throw PropertyTypeMismatchException(to_string(dict.get_type()), to_string(value.type)); | |
} | |
if (value.is_null()) { | |
if (!is_nullable(dict.get_type())) { | |
throw NotNullable("Attempted to add null to a dictionary of required values"); | |
} | |
} | |
else { | |
if (dict.get_type() != PropertyType::Mixed && to_capi(dict.get_type()) != value.type) { | |
throw PropertyTypeMismatchException(to_string(dict.get_type()), to_string(value.type)); | |
} | |
} |
Wouldn't it be better to avoid to repeat is_null()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it makes sense to me. I just left a cosmetic question.
For the tests there is just a timeout on Maui.Android. So all looks good on that front too. Just don't forget to add an entry in the changelog.
As a side note: I know it's not our decision, it's core's. But, I'm not sure ErrorCodes::Error::OK
is a better choice than ...::NoError
😅
# Conflicts: # wrappers/realm-core
Description
Fixes #2796
TODO