-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #736 from massalabs/getdatastoreentry_null_when_no…
…_value if non existing datastore entry return null
- Loading branch information
Showing
10 changed files
with
149 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,34 @@ | ||
import { ErrorBase } from './base' | ||
import { ErrorCodes } from './utils/codes' | ||
|
||
type ErrorDataEntryNotFoundParameters = { | ||
key: Uint8Array | string | ||
address: string | ||
details?: string | ||
} | ||
|
||
/** | ||
* Error class for handling the situation when a data entry has not been found in a smart contract datastore. | ||
*/ | ||
export class ErrorDataEntryNotFound extends ErrorBase { | ||
/** | ||
* Override the name to clearly identify this as a ErrorDataEntryNotFound. | ||
*/ | ||
override name = 'ErrorDataEntryNotFound' | ||
|
||
/** | ||
* Constructs a ErrorDataEntryNotFound with a message indicating the missing data entry. | ||
* @param key - The key of the data entry that was not found. | ||
* @param address - The address of the smart contract datastore where the entry was expected. | ||
* @param details - Optional details to provide more context about the error. | ||
*/ | ||
constructor({ key, address, details }: ErrorDataEntryNotFoundParameters) { | ||
super( | ||
`The data entry with key ${key} was not found in the datastore of the contract at address ${address}.`, | ||
{ | ||
code: ErrorCodes.DataEntryNotFound, | ||
details, | ||
} | ||
) | ||
} | ||
} |
This file contains 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 |
---|---|---|
|
@@ -3,4 +3,5 @@ export enum ErrorCodes { | |
MaxGasLimit, | ||
InsufficientBalance, | ||
MinimalFee, | ||
DataEntryNotFound, | ||
} |
This file contains 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 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 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 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
6bf0457
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.
Coverage report for experimental massa-web3
Test suite run success
134 tests passing in 15 suites.
Report generated by 🧪jest coverage report action from 6bf0457