Skip to content
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

Add exception handling for exception logging #229

Merged
merged 3 commits into from
Jun 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Hyperion/ValueSerializers/ObjectSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,18 @@ public override void WriteManifest(Stream stream, SerializerSession session)
public override void WriteValue(Stream stream, object value, SerializerSession session)
=> _writer(stream, value, session);

public override object ReadValue(Stream stream, DeserializerSession session) => _reader(stream, session);
public override object ReadValue(Stream stream, DeserializerSession session)
{
try
{
return _reader(stream, session);
}
catch (Exception e)
{
throw new Exception(
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a SerializationException or something more specific? Do we have any Hyperion-specific exception types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SerializationException doesn't exist in netstandard1.6 and net45

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess we can add System.Runtime.Serialization.Primitives package to add it in?

$"Failed to deserialize object of type [{Type}] from the stream.", e);
}
}

public override Type GetElementType() => Type;

Expand Down