-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added new speckle exceptions and split into single files (#136)
* feat: Added new speckle exceptions and split into single files * fix: Run format
- Loading branch information
Showing
5 changed files
with
92 additions
and
108 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Speckle.Sdk.Common.Exceptions; | ||
|
||
/// <summary> | ||
/// Exception thrown when conversion of an object was not successful | ||
/// </summary> | ||
/// <remarks> | ||
/// Ideally this exception contains a meaningful message. | ||
/// This exception can be used for both ToSpeckle and ToNative conversion | ||
/// </remarks> | ||
public class ConversionException : SpeckleException | ||
{ | ||
public ConversionException(string? message, Exception? innerException) | ||
: base(message, innerException) { } | ||
|
||
public ConversionException(string? message) | ||
: base(message) { } | ||
|
||
public ConversionException() { } | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Speckle.Sdk/Common/Exceptions/ConversionNotSupportedException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace Speckle.Sdk.Common.Exceptions; | ||
|
||
/// <summary> | ||
/// Exception used when an object could not be converted, because we don't support a specific conversion. | ||
/// </summary> | ||
/// <remarks> | ||
/// This Exception should be thrown only when a top-level converter does not exist.</remarks> | ||
/// <example> | ||
/// It should <b>NOT</b> be used for: | ||
/// <ul> | ||
/// <li> objects who's <see cref="Type"/> we don't support (e.g. <c>"Walls are not supported"</c>)</li> | ||
/// <li> objects with a property whose value we don't support (e.g. <c>"Beams with shape type of Circular are not supported"</c>)</li> | ||
/// <li> complex object requirements (e.g. <c>"We don't support walls with zero width and no displayValue"</c>)</li> | ||
/// <li> Invalid Speckle Objects (e.g. <c>"We don't support walls with null lines"</c>)</li> | ||
/// <li> Objects that we have already converted, and therefore now skip (e.g. <c>"A Wall with the same name was already converted"</c>)</li> | ||
/// <li> Reactive error handling (e.g. "Failed to convert wall, I guess it wasn't supported")</li> | ||
/// </ul> | ||
/// </example> | ||
public class ConversionNotSupportedException : ConversionException | ||
{ | ||
public ConversionNotSupportedException(string message, Exception innerException) | ||
: base(message, innerException) { } | ||
|
||
public ConversionNotSupportedException(string message) | ||
: base(message) { } | ||
|
||
public ConversionNotSupportedException() { } | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Speckle.Sdk/Common/Exceptions/UnitNotSupportedException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Speckle.Sdk.Common.Exceptions; | ||
|
||
/// <summary> | ||
/// Exception thrown when a unit is encountered that is not supported, either by Speckle or the host app. | ||
/// </summary> | ||
public class UnitNotSupportedException : SpeckleException | ||
{ | ||
public UnitNotSupportedException() { } | ||
|
||
public UnitNotSupportedException(string message) | ||
: base(message) { } | ||
|
||
public UnitNotSupportedException(string message, Exception innerException) | ||
: base(message, innerException) { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace Speckle.Sdk.Common.Exceptions; | ||
|
||
/// <summary> | ||
/// Exception thrown when conversion cannot be performed | ||
/// </summary> | ||
/// <remarks>Ideally, this exception should be thrown when we can pre-emptively check for invalid data that is known to cause an exception under normal circumstances</remarks> | ||
/// <example> | ||
/// It can be used for: | ||
/// <ul> | ||
/// <li> Invalid Speckle Objects (e.g. <c>"We don't support walls with null lines"</c>)</li> | ||
/// <li> objects with a property whose value we don't support (e.g. <c>"Beams with shape type of Circular are not supported"</c>)</li> | ||
/// <li> complex object requirements (e.g. <c>"We don't support walls with zero width and no displayValue"</c>)</li> | ||
/// </ul> | ||
/// It should <b>NOT</b> be used for: | ||
/// <ul> | ||
/// <li> Objects we have no top-level converter for</li> | ||
/// <li> Objects that we have already converted, and therefore now skip (e.g. <c>"A Wall with the same name was already converted"</c>)</li> | ||
/// <li> Reactive error handling (e.g. "Failed to convert wall, I guess it wasn't supported")</li> | ||
/// </ul> | ||
/// </example> | ||
public class ValidationException : SpeckleException | ||
{ | ||
public ValidationException() { } | ||
|
||
public ValidationException(string message) | ||
: base(message) { } | ||
|
||
public ValidationException(string message, Exception innerException) | ||
: base(message, innerException) { } | ||
} |