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

32 Exception Handling #46

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions skullOS.Modules/Adventure.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using skullOS.Core;
using skullOS.HardwareServices;
using skullOS.HardwareServices.Interfaces;
using skullOS.Modules.Exceptions;
using skullOS.Modules.Interfaces;
using Timer = System.Timers.Timer;

Expand Down Expand Up @@ -34,12 +35,12 @@ private void TakePicture_Elapsed(object? sender, System.Timers.ElapsedEventArgs

public override void OnAction(object? sender, EventArgs e)
{
throw new NotImplementedException();
throw new OnActionException("Adventure does not support OnAction");
}

public override void OnEnable(string[] args)
{
throw new NotImplementedException();
throw new OnEnableException("Adventure does not support OnEnable");
}

public override string ToString()
Expand Down
5 changes: 3 additions & 2 deletions skullOS.Modules/Buzzer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using skullOS.HardwareServices;
using skullOS.Modules.Exceptions;
using skullOS.Modules.Interfaces;
using static skullOS.Modules.BuzzerLibrary;
using static skullOS.Modules.BuzzerStructures;
Expand Down Expand Up @@ -34,11 +35,11 @@ public void PlayTune(Tunes tuneToPlay)

public override void OnAction(object? sender, EventArgs e)
{
throw new NotImplementedException();
throw new OnActionException("Buzzer does not support OnAction");
}
public override void OnEnable(string[] args)
{
throw new NotImplementedException();
throw new OnEnableException("Buzzer does not support OnEnable");
}
public override string ToString()
{
Expand Down
6 changes: 6 additions & 0 deletions skullOS.Modules/Exceptions/OnActionException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace skullOS.Modules.Exceptions
{
public class OnActionException(string message) : Exception(message)
{
}
}
6 changes: 6 additions & 0 deletions skullOS.Modules/Exceptions/OnEnableException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace skullOS.Modules.Exceptions
{
public class OnEnableException(string message) : Exception(message)
{
}
}
5 changes: 3 additions & 2 deletions skullOS.Modules/Prop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using skullOS.Core;
using skullOS.HardwareServices;
using skullOS.HardwareServices.Interfaces;
using skullOS.Modules.Exceptions;
using System.Device.Pwm.Drivers;
using Timer = System.Timers.Timer;

Expand Down Expand Up @@ -102,12 +103,12 @@ private async void FlapEar(bool useLeft = true)

public override void OnAction(object? sender, EventArgs e)
{
throw new NotImplementedException();
throw new OnActionException("Prop doesn't support OnAction");
}

public override void OnEnable(string[] args)
{
throw new NotImplementedException();
throw new OnEnableException("Prop doesn't support OnEnable");
}
public override string ToString()
{
Expand Down
5 changes: 3 additions & 2 deletions skullOS.Modules/Support.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using skullOS.HardwareServices;
using skullOS.HardwareServices.Interfaces;
using skullOS.Modules.Exceptions;
using skullOS.Modules.Interfaces;
using System.Device.Gpio;
using Timer = System.Timers.Timer;
Expand Down Expand Up @@ -42,12 +43,12 @@ private void LowBatteryAlert_Elapsed(object? sender, System.Timers.ElapsedEventA

public override void OnAction(object? sender, EventArgs e)
{
throw new NotImplementedException();
throw new OnActionException("Support doesn't support OnAction");
}

public override void OnEnable(string[] args)
{
throw new NotImplementedException();
throw new OnEnableException("Support doesn't support OnEnable");
}

public override string ToString()
Expand Down
Loading