Simplify code in all exception types
このコミットが含まれているのは:
1 親
3be6767584
コミット
afd4649a55
6ファイル変更
+41
-52
検索条件に一致するファイルはありません
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace ComputeSharp.Exceptions;
|
||||
|
||||
@@ -24,15 +23,15 @@ public sealed class DxcCompilationException : Exception
|
||||
/// <returns>A formatted error message for a new <see cref="DxcCompilationException"/> instance.</returns>
|
||||
private static string GetExceptionMessage(string error)
|
||||
{
|
||||
StringBuilder builder = new(512);
|
||||
#if NET6_0_OR_GREATER
|
||||
ReadOnlySpan<char> message = error.AsSpan().Trim();
|
||||
#else
|
||||
string message = error.Trim();
|
||||
#endif
|
||||
|
||||
_ = builder.AppendLine("The DXC compiler encountered one or more errors while trying to compile the shader:");
|
||||
_ = builder.AppendLine();
|
||||
_ = builder.AppendLine(error.Trim());
|
||||
_ = builder.AppendLine();
|
||||
_ = builder.AppendLine("Make sure to only be using supported features by checking the README file in the ComputeSharp repository: https://github.com/Sergio0694/ComputeSharp.");
|
||||
_ = builder.Append("If you're sure that your C# shader code is valid, please open an issue an include a working repro and this error message.");
|
||||
|
||||
return builder.ToString();
|
||||
return
|
||||
$"""The DXC compiler encountered one or more errors while trying to compile the shader: "{message}". """ +
|
||||
$"""Make sure to only be using supported features by checking the README file in the ComputeSharp repository: https://github.com/Sergio0694/ComputeSharp. """ +
|
||||
$"""If you're sure that your C# shader code is valid, please open an issue an include a working repro and this error message.""";
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする