Change to generic exception handler for better visibility
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m44s

This commit is contained in:
Robert Marshall 2025-07-05 20:18:48 +01:00
parent d7ca461fc8
commit 4be01f477f
2 changed files with 72 additions and 62 deletions

View file

@ -1,19 +1,48 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Build Schema",
"$ref": "#/definitions/build",
"definitions": {
"build": {
"type": "object",
"Host": {
"type": "string",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"ExecutableTarget": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Publish",
"Restore",
"Test"
]
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
@ -23,25 +52,8 @@
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
"$ref": "#/definitions/Host"
},
"NoLogo": {
"type": "boolean",
@ -70,45 +82,42 @@
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Publish",
"Restore",
"Test"
]
"$ref": "#/definitions/ExecutableTarget"
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Publish",
"Restore",
"Test"
]
"$ref": "#/definitions/ExecutableTarget"
}
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
]
"$ref": "#/definitions/Verbosity"
}
}
}
}
},
"allOf": [
{
"properties": {
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
}
}
},
{
"$ref": "#/definitions/NukeBuild"
}
]
}

View file

@ -6,6 +6,7 @@ using Newtonsoft.Json;
using Robware.Projects.Code;
using Robware.Projects.Gogs.Models;
using Robware.Projects.Gogs.States;
using System;
namespace Robware.Projects.Gogs {
public class GogsApi : IGitApi {
@ -24,7 +25,7 @@ namespace Robware.Projects.Gogs {
try {
return (await Get<IEnumerable<RepositoryState>>($"api/v1/users/{user}/repos")).Select(state => new GogsRepository(state));
}
catch (HttpRequestException e) {
catch (Exception e) {
throw new UserNotFoundException(user, e);
}
}
@ -33,7 +34,7 @@ namespace Robware.Projects.Gogs {
try {
return (await Get<IEnumerable<BranchState>>($"api/v1/repos/{user}/{repository}/branches")).Select(state => new GogsBranch(state));
}
catch (HttpRequestException e) {
catch (Exception e) {
throw new RepositoryNotFoundException(user, repository, e);
}
}
@ -42,7 +43,7 @@ namespace Robware.Projects.Gogs {
try {
return new GogsCommit(await Get<CommitDetailsState>($"api/v1/repos/{user}/{repository}/commits/{hash}"));
}
catch (HttpRequestException e) {
catch (Exception e) {
throw new CommitNotFoundException(user, repository, hash, e);
}
}