namespace Backend.Utils; public class Result { private const String OkMsg = "Ok"; private readonly String _Error; public static Result Ok = new Result(OkMsg); public Boolean IsError => _Error != OkMsg; public Boolean IsSuccess => _Error == OkMsg; private Result(String error) => _Error = error; public static Result Error(String error) => new Result(error); public static Result Error(Exception exception) { #if DEBUG var msg = exception.ToString(); // includes stacktrace #else var msg = exception.Message; // excludes stacktrace #endif return new Result(msg); } }