- 
                Notifications
    
You must be signed in to change notification settings  - Fork 816
 
Send AppErrors from p2p SDK #2753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            23 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      a7d29eb
              
                send AppErrors from p2p sdk
              
              
                joshua-kim e9fd0b1
              
                nit
              
              
                joshua-kim 7a46365
              
                nit
              
              
                joshua-kim 983b8b1
              
                nit
              
              
                joshua-kim bef44da
              
                nit
              
              
                joshua-kim 2aebdd9
              
                nit
              
              
                joshua-kim f1f98d3
              
                nit
              
              
                joshua-kim 619235b
              
                add uts
              
              
                joshua-kim 5217b56
              
                nit
              
              
                joshua-kim a717dde
              
                Squashed commit of the following:
              
              
                joshua-kim 17ed26d
              
                Merge branch 'master' into p2p-sdk-app-error
              
              
                joshua-kim ee255fd
              
                nit
              
              
                joshua-kim c258e4a
              
                nit
              
              
                joshua-kim 1fa80e7
              
                undo diff
              
              
                joshua-kim b50615e
              
                nit
              
              
                joshua-kim d198b0b
              
                nit
              
              
                joshua-kim d895541
              
                Merge branch 'master' into p2p-sdk-app-error
              
              
                joshua-kim 6dd29a8
              
                nit
              
              
                joshua-kim 8343a41
              
                 nit
              
              
                joshua-kim 87a2b4f
              
                nit
              
              
                joshua-kim d2400e9
              
                Merge branch 'master' into p2p-sdk-app-error
              
              
                joshua-kim 348b322
              
                update coreth version
              
              
                StephenButtolph e316954
              
                merged
              
              
                StephenButtolph File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. | ||
| // See the file LICENSE for licensing terms. | ||
| 
     | 
||
| package p2p | ||
| 
     | 
||
| import "github.com/ava-labs/avalanchego/snow/engine/common" | ||
| 
     | 
||
| var ( | ||
| // ErrUnexpected should be used to indicate that a request failed due to a | ||
| // generic error | ||
| ErrUnexpected = &common.AppError{ | ||
| Code: -1, | ||
| Message: "unexpected error", | ||
| } | ||
| // ErrUnregisteredHandler should be used to indicate that a request failed | ||
| // due to it not matching a registered handler | ||
| ErrUnregisteredHandler = &common.AppError{ | ||
| Code: -2, | ||
| Message: "unregistered handler", | ||
| } | ||
| // ErrNotValidator should be used to indicate that a request failed due to | ||
| // the requesting peer not being a validator | ||
| ErrNotValidator = &common.AppError{ | ||
| Code: -3, | ||
| Message: "not a validator", | ||
| } | ||
| // ErrThrottled should be used to indicate that a request failed due to the | ||
| // requesting peer exceeding a rate limit | ||
| ErrThrottled = &common.AppError{ | ||
| Code: -4, | ||
| Message: "throttled", | ||
| } | ||
| ) | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how to handle this - we decided to reserve negative error codes for our use + positive error codes for developer use. This is a weird intersection since the p2p package is technically a vm implementation detail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine, the VM opts into this standard when it uses the p2p sdk, we can probably highlight it in the readme for the sdk.