Skip to content

Enhance permission denied exception logs#875

Merged
pawelpasterz merged 15 commits into
masterfrom
clean-permission-denied-exception-log
Jul 6, 2020
Merged

Enhance permission denied exception logs#875
pawelpasterz merged 15 commits into
masterfrom
clean-permission-denied-exception-log

Conversation

@pawelpasterz
Copy link
Copy Markdown
Contributor

@pawelpasterz pawelpasterz commented Jul 1, 2020

Fixes #874

Test Plan

How do we know the code works?

1. User don't have permission to project (403)

When user don't have permission to project Flank should returns message like:


Flank encountered a 403 error when running on project $project_name. Please verify this credential is authorized for the project.
Consider authentication with a Service Account https://github.com/Flank/flank#authenticate-with-a-service-account
or with a Google account https://github.com/Flank/flank#authenticate-with-a-google-account

Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
  "code" : 403,
  "errors" : [ {
    "domain" : "global",
    "message" : "The caller does not have permission",
    "reason" : "forbidden"
  } ],
  "message" : "The caller does not have permission",
  "status" : "PERMISSION_DENIED"
}

2. Project not found (404)

When project not found on firebase Flank should return message like:


Flank was unable to find project $project_name. Please verify the project id.

Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
{
  "code" : 404,
  "errors" : [ {
    "domain" : "global",
    "message" : "Project not found: $project_name",
    "reason" : "notFound"
  } ],
  "message" : "Project not found: $project_name",
  "status" : "NOT_FOUND"
}

3. On this two cases Flank throws FlankCommonException and exit with code: 1

Checklist

  • Documented
  • Unit tested
  • release_notes.md updated

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #875 into master will decrease coverage by 0.03%.
The diff coverage is 75.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #875      +/-   ##
============================================
- Coverage     82.75%   82.72%   -0.04%     
  Complexity      638      638              
============================================
  Files           172      172              
  Lines          3370     3386      +16     
  Branches        481      483       +2     
============================================
+ Hits           2789     2801      +12     
- Misses          311      316       +5     
+ Partials        270      269       -1     

Comment thread test_runner/src/main/kotlin/ftl/gc/GcToolResults.kt Outdated
Comment thread test_runner/src/main/kotlin/ftl/gc/GcToolResults.kt Outdated
Comment thread test_runner/src/main/kotlin/ftl/gc/GcToolResults.kt Outdated
Comment thread test_runner/src/main/kotlin/ftl/gc/GcToolResults.kt Outdated
@bootstraponline
Copy link
Copy Markdown
Contributor

The pull request looks great! I left some small comments about updating the wording.

Comment thread test_runner/src/main/kotlin/ftl/http/ExecuteWithRetry.kt Outdated
@adamfilipow92 adamfilipow92 requested a review from jan-goral July 2, 2020 11:17
@adamfilipow92 adamfilipow92 force-pushed the clean-permission-denied-exception-log branch from aa61f6b to 48a64a2 Compare July 2, 2020 11:59
@adamfilipow92 adamfilipow92 marked this pull request as ready for review July 2, 2020 12:08
Comment thread docs/permissions_denied_behavior.md Outdated
Comment thread docs/permissions_denied_behavior.md Outdated
Comment thread test_runner/src/main/kotlin/ftl/gc/GcToolResults.kt Outdated
Comment thread test_runner/src/test/kotlin/ftl/gc/GcToolResultsTest.kt Outdated
@pawelpasterz pawelpasterz force-pushed the clean-permission-denied-exception-log branch from 7d212cf to f6e8c7d Compare July 3, 2020 18:49
@pawelpasterz pawelpasterz requested a review from jan-goral July 3, 2020 18:53
jan-goral
jan-goral previously approved these changes Jul 6, 2020
@pawelpasterz pawelpasterz force-pushed the clean-permission-denied-exception-log branch from c7bff59 to c2546ac Compare July 6, 2020 19:12
@pawelpasterz pawelpasterz force-pushed the clean-permission-denied-exception-log branch from 2d13bfc to b8c0856 Compare July 6, 2020 19:14
@pawelpasterz pawelpasterz merged commit 54930da into master Jul 6, 2020
@pawelpasterz pawelpasterz deleted the clean-permission-denied-exception-log branch July 6, 2020 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean flank not authorized error messages

5 participants