Skip to content

Commit

Permalink
[CastIt.Domain] Added a new ffmpeg exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Jul 4, 2021
1 parent f58680d commit 7c4fefc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CastIt.Domain/Enums/AppMessageType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ public enum AppMessageType
ConnectionToDeviceIsStillInProgress = 302,
FFmpegError = 303,
ServerIsClosing = 304,
FFmpegExecutableNotFound = 305,
}
}
18 changes: 18 additions & 0 deletions CastIt.Domain/Exceptions/FFMpegInvalidExecutable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using CastIt.Domain.Enums;

namespace CastIt.Domain.Exceptions
{
public class FFmpegInvalidExecutable : BaseAppException
{
public FFmpegInvalidExecutable(string ffmpegPath, string ffprobePath) : this(
$"Either the ffmpeg exe = {ffmpegPath} or ffprobe exe = {ffprobePath} are not valid or were not found",
AppMessageType.FFmpegExecutableNotFound)
{
}

private FFmpegInvalidExecutable(string message, AppMessageType errorMessageId)
: base(message, errorMessageId)
{
}
}
}
1 change: 1 addition & 0 deletions CastIt.Domain/Extensions/AppMessageTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public static string GetErrorMsg(this AppMessageType type)
AppMessageType.FileNotFound => "File was not found",
AppMessageType.FFmpegError => "Unknown error on FFmpeg",
AppMessageType.ServerIsClosing => "Server is closing",
AppMessageType.FFmpegExecutableNotFound => "Ffmpeg executable is not valid or was not found",
_ => throw new ArgumentOutOfRangeException(nameof(type), type, $"The provided type = {type} is not valid")
};
}
Expand Down

0 comments on commit 7c4fefc

Please sign in to comment.