Skip to content

Commit

Permalink
fix: Add inner exception (#4)
Browse files Browse the repository at this point in the history
* add inner exception

* Some annotation changes

* Added some comments to silence the compiler
  • Loading branch information
DarkRRb authored May 7, 2024
1 parent c166cb0 commit 1ce3e76
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Konata.Codec/Audio/Codecs/SilkV3Codec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public override int Read(byte[] buffer, int offset, int count)
Position = 0;
}

// Catch native exceptions
catch
// Catch exceptions
catch (Exception e)
{
throw new EncodeException("Thrown an exception while encoding silk.");
throw new EncodeException("Thrown an exception while encoding silk.", e);
}

// Cleanup
Expand Down Expand Up @@ -165,10 +165,10 @@ public override int Read(byte[] buffer, int offset, int count)
Position = 0;
}

// Catch native exceptions
catch
// Catch exceptions
catch (Exception e)
{
throw new EncodeException("Thrown an exception while decoding silk.");
throw new EncodeException("Thrown an exception while decoding silk.", e);
}

// Cleanup
Expand Down
3 changes: 3 additions & 0 deletions Konata.Codec/Audio/Codecs/VorbisCodec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace Konata.Codec.Audio.Codecs;
/// </summary>
public class VorbisCodec
{
/// <summary>
/// Vorbis decoder
/// </summary>
public class Decoder : AudioStream
{
private readonly VorbisReader _stream;
Expand Down
1 change: 1 addition & 0 deletions Konata.Codec/Audio/Codecs/WavCodec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public Decoder(Stream file)
internal override AudioInfo? GetAdaptiveOutput()
=> _output;

/// <inheritdoc/>
public override void Flush()
=> _stream.Flush();

Expand Down
5 changes: 3 additions & 2 deletions Konata.Codec/Exceptions/DecodeException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public class DecodeException : Exception
/// Decode exception
/// </summary>
/// <param name="message"></param>
public DecodeException(string message)
: base(message)
/// <param name="inner"></param>
public DecodeException(string message, Exception inner = null)
: base(message, inner)
{
}

Expand Down
5 changes: 3 additions & 2 deletions Konata.Codec/Exceptions/EncodeException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public class EncodeException : Exception
/// Encode exception
/// </summary>
/// <param name="message"></param>
public EncodeException(string message)
: base(message)
/// <param name="inner"></param>
public EncodeException(string message, Exception inner = null)
: base(message, inner)
{
}
}

0 comments on commit 1ce3e76

Please sign in to comment.