Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Include exception information #3077

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/ApiService/ApiService/onefuzzlib/notifications/Ado.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ public static async Async.Task<OneFuzzResultVoid> Validate(AdoTemplate config) {
try {
connection = new VssConnection(config.BaseUrl, new VssBasicCredential(string.Empty, token.Value));
await connection.ConnectAsync();
} catch {
return OneFuzzResultVoid.Error(ErrorCode.ADO_VALIDATION_INVALID_PAT, $"Failed to connect to {config.BaseUrl} using the provided token");
} catch (Exception e) {
return OneFuzzResultVoid.Error(ErrorCode.ADO_VALIDATION_INVALID_PAT, new string[] {
$"Failed to connect to {config.BaseUrl} using the provided token",
$"Exception: {e}"
});
}
} else {
return OneFuzzResultVoid.Error(ErrorCode.ADO_VALIDATION_INVALID_PAT, "Auth token is missing or invalid");
Expand All @@ -98,8 +101,11 @@ public static async Async.Task<OneFuzzResultVoid> Validate(AdoTemplate config) {
}
);
}
} catch {
return OneFuzzResultVoid.Error(ErrorCode.ADO_VALIDATION_INVALID_FIELDS, "Failed to query and compare the valid fields for this project");
} catch (Exception e) {
return OneFuzzResultVoid.Error(ErrorCode.ADO_VALIDATION_INVALID_FIELDS, new string[] {
"Failed to query and compare the valid fields for this project",
$"Exception: {e}"
});
}

return OneFuzzResultVoid.Ok;
Expand Down
14 changes: 10 additions & 4 deletions src/ApiService/ApiService/onefuzzlib/notifications/GithubIssues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,23 @@ public static async Async.Task<OneFuzzResultVoid> Validate(GithubIssuesTemplate
try {
gh = GetGitHubClient(auth.Value.User, auth.Value.PersonalAccessToken);
var _ = await gh.User.Get(auth.Value.User);
} catch {
return OneFuzzResultVoid.Error(ErrorCode.GITHUB_VALIDATION_INVALID_PAT, $"Failed to login to github.com with user {auth.Value.User} and the provided Personal Access Token");
} catch (Exception e) {
return OneFuzzResultVoid.Error(ErrorCode.GITHUB_VALIDATION_INVALID_PAT, new string[] {
$"Failed to login to github.com with user {auth.Value.User} and the provided Personal Access Token",
$"Exception: {e}"
});
}
} else {
return OneFuzzResultVoid.Error(ErrorCode.GITHUB_VALIDATION_INVALID_PAT, $"GithubAuth is missing or invalid");
}

try {
var _ = await gh.Repository.Get(config.Organization, config.Repository);
} catch {
return OneFuzzResultVoid.Error(ErrorCode.GITHUB_VALIDATION_INVALID_REPOSITORY, $"Failed to access repository: {config.Organization}/{config.Repository}");
} catch (Exception e) {
return OneFuzzResultVoid.Error(ErrorCode.GITHUB_VALIDATION_INVALID_REPOSITORY, new string[] {
$"Failed to access repository: {config.Organization}/{config.Repository}",
$"Exception: {e}"
});
}

return OneFuzzResultVoid.Ok;
Expand Down