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,30 +1,8 @@
{ {
"$schema": "http://json-schema.org/draft-04/schema#", "$schema": "http://json-schema.org/draft-04/schema#",
"title": "Build Schema",
"$ref": "#/definitions/build",
"definitions": { "definitions": {
"build": {
"type": "object",
"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"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": { "Host": {
"type": "string", "type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [ "enum": [
"AppVeyor", "AppVeyor",
"AzurePipelines", "AzurePipelines",
@ -43,6 +21,40 @@
"VSCode" "VSCode"
] ]
}, },
"ExecutableTarget": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Publish",
"Restore",
"Test"
]
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"description": "Host for execution. Default is 'automatic'",
"$ref": "#/definitions/Host"
},
"NoLogo": { "NoLogo": {
"type": "boolean", "type": "boolean",
"description": "Disables displaying the NUKE logo" "description": "Disables displaying the NUKE logo"
@ -70,45 +82,42 @@
"type": "array", "type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies", "description": "List of targets to be skipped. Empty list skips all dependencies",
"items": { "items": {
"type": "string", "$ref": "#/definitions/ExecutableTarget"
"enum": [
"Clean",
"Compile",
"Publish",
"Restore",
"Test"
]
} }
}, },
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": { "Target": {
"type": "array", "type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'", "description": "List of targets to be invoked. Default is '{default_target}'",
"items": { "items": {
"type": "string", "$ref": "#/definitions/ExecutableTarget"
"enum": [
"Clean",
"Compile",
"Publish",
"Restore",
"Test"
]
} }
}, },
"Verbosity": { "Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'", "description": "Logging verbosity during build execution. Default is 'Normal'",
"$ref": "#/definitions/Verbosity"
}
}
}
},
"allOf": [
{
"properties": {
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [ "enum": [
"Minimal", "Debug",
"Normal", "Release"
"Quiet", ]
"Verbose" },
"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.Code;
using Robware.Projects.Gogs.Models; using Robware.Projects.Gogs.Models;
using Robware.Projects.Gogs.States; using Robware.Projects.Gogs.States;
using System;
namespace Robware.Projects.Gogs { namespace Robware.Projects.Gogs {
public class GogsApi : IGitApi { public class GogsApi : IGitApi {
@ -24,7 +25,7 @@ namespace Robware.Projects.Gogs {
try { try {
return (await Get<IEnumerable<RepositoryState>>($"api/v1/users/{user}/repos")).Select(state => new GogsRepository(state)); 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); throw new UserNotFoundException(user, e);
} }
} }
@ -33,7 +34,7 @@ namespace Robware.Projects.Gogs {
try { try {
return (await Get<IEnumerable<BranchState>>($"api/v1/repos/{user}/{repository}/branches")).Select(state => new GogsBranch(state)); 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); throw new RepositoryNotFoundException(user, repository, e);
} }
} }
@ -42,7 +43,7 @@ namespace Robware.Projects.Gogs {
try { try {
return new GogsCommit(await Get<CommitDetailsState>($"api/v1/repos/{user}/{repository}/commits/{hash}")); 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); throw new CommitNotFoundException(user, repository, hash, e);
} }
} }