Skip to content

Instantly share code, notes, and snippets.

@CJ42
Created March 21, 2023 07:58
Show Gist options
  • Save CJ42/5069566b346f6f0e77ba315c8088e964 to your computer and use it in GitHub Desktop.
Save CJ42/5069566b346f6f0e77ba315c8088e964 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
// We are missing to put the `requested` parameter name next to the `@param` tag.
// ---
// DocstringParsingError: Documented parameter "an" not found in the parameter list of the function.
/**
* @dev error when trying to transfer more `requested` amount than `available
* @param an amount in wei to be transfered
*/
error InsufficientBalance(uint256 requested, uint256 available);
// we made a typo and wrote `request` instead of `requested` for the 1st param name (missing `ed` at the end)
// ---
// DocstringParsingError: Documented parameter "request" not found in the parameter list of the function.
/**
* @dev error when trying to transfer more `requested` amount than `available
* @param request an amount in wei to be transfered
* @param available the amount of wei available in msg.sender's balance
*/
error InsufficientBalance(uint256 requested, uint256 available);
// we are using a Natspec tag that does not exist (`@test`)
// ---
// DocstringParsingError: Documentation tag @test not valid for errors.
/**
* @dev error when trying to transfer more `requested` amount than `available
* @param requested an amount in wei to be transfered
* @param available the amount of wei available in msg.sender's balance
* @test
*/
error InsufficientBalance(uint256 requested, uint256 available);
// we are trying to use a Natspec tag that is valid but cannot be assigned to the definition type
// (e.g: using the @title tag above `function`, using the @param tag above `contract`, ...
// ---
// DocstringParsingError: Documentation tag @title not valid for errors.
/**
* @title
* @dev error when trying to transfer more `requested` amount than `available
* @param requested an amount in wei to be transfered
* @param available the amount of wei available in msg.sender's balance
*/
error InsufficientBalance(uint256 requested, uint256 available);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment