diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-14 07:40:58 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-14 07:40:58 +0530 |
commit | 2f239481cdd750c2cbe85b012bdeb69841298c42 (patch) | |
tree | ab2e186632777200d4ba4ccf26503b1a4baa1dbe /errors | |
parent | 9de7dcb3b45a86ee0de0e2b6f3044a859ed5ea08 (diff) |
returning 'invalid quantity' error instead of 'invalid gst' in case of invalid quantityv0.23.1
Diffstat (limited to 'errors')
-rw-r--r-- | errors/errors.go | 41 | ||||
-rw-r--r-- | errors/status.go | 3 |
2 files changed, 23 insertions, 21 deletions
diff --git a/errors/errors.go b/errors/errors.go index 3c37e08..1858834 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -1,5 +1,5 @@ /* openbills - Server for web based Libre Billing Software - * Copyright (C) 2023-2024 Vidhu Kant Sharma <vidhukant@vidhukant.com> + * Copyright (C) 2023-2025 Vidhu Kant Sharma <vidhukant@vidhukant.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,25 +26,26 @@ var ( ErrEmptyResponse = errors.New("No Records Found") // 400 - ErrNoWhereCondition = errors.New("No Where Condition") - ErrInvalidID = errors.New("Invalid ID") - ErrEmptyContactName = errors.New("Contact Name Cannot Be Empty") - ErrInvalidGSTIN = errors.New("Invalid GSTIN") - ErrInvalidEmail = errors.New("Invalid E-Mail Address") - ErrEmptyEmail = errors.New("E-Mail Address Cannot Be Empty") - ErrInvalidUsername = errors.New("Invalid Username") - ErrEmptyUsername = errors.New("Username Cannot Be Empty") - ErrInvalidPhone = errors.New("Invalid Phone Number") - ErrInvalidWebsite = errors.New("Invalid Website URL") - ErrEmptyBrandName = errors.New("Brand Name Cannot Be Empty") - ErrInvalidUnitPrice = errors.New("Invalid Unit Price") - ErrInvalidGSTPercentage = errors.New("Invalid GST Percentage") - ErrPasswordTooShort = errors.New("Password Is Too Short") - ErrPasswordTooLong = errors.New("Password Is Too Long") - ErrUsernameTooShort = errors.New("Username Is Too Short") - ErrUsernameTooLong = errors.New("Username Is Too Long") - ErrInvalidLoginMethod = errors.New("Login Method Can Only Be 'email' Or 'username'") - ErrNoItemVariants = errors.New("An item should have at least one variant") + ErrNoWhereCondition = errors.New("No Where Condition") + ErrInvalidID = errors.New("Invalid ID") + ErrEmptyContactName = errors.New("Contact Name Cannot Be Empty") + ErrInvalidGSTIN = errors.New("Invalid GSTIN") + ErrInvalidEmail = errors.New("Invalid E-Mail Address") + ErrEmptyEmail = errors.New("E-Mail Address Cannot Be Empty") + ErrInvalidUsername = errors.New("Invalid Username") + ErrEmptyUsername = errors.New("Username Cannot Be Empty") + ErrInvalidPhone = errors.New("Invalid Phone Number") + ErrInvalidWebsite = errors.New("Invalid Website URL") + ErrEmptyBrandName = errors.New("Brand Name Cannot Be Empty") + ErrInvalidUnitPrice = errors.New("Invalid Unit Price") + ErrInvalidGSTPercentage = errors.New("Invalid GST Percentage") + ErrInvalidQuantityInStock = errors.New("Invalid Stock Quantity") + ErrPasswordTooShort = errors.New("Password Is Too Short") + ErrPasswordTooLong = errors.New("Password Is Too Long") + ErrUsernameTooShort = errors.New("Username Is Too Short") + ErrUsernameTooLong = errors.New("Username Is Too Long") + ErrInvalidLoginMethod = errors.New("Login Method Can Only Be 'email' Or 'username'") + ErrNoItemVariants = errors.New("An item should have at least one variant") // 401 ErrWrongPassword = errors.New("Wrong Password") diff --git a/errors/status.go b/errors/status.go index 0bbb7ba..708165a 100644 --- a/errors/status.go +++ b/errors/status.go @@ -1,5 +1,5 @@ /* openbills - Server for web based Libre Billing Software - * Copyright (C) 2023 Vidhu Kant Sharma <vidhukant@vidhukant.com> + * Copyright (C) 2023-2025 Vidhu Kant Sharma <vidhukant@vidhukant.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,6 +42,7 @@ func StatusCodeFromErr(err error) int { errors.Is(err, ErrPasswordTooLong) || errors.Is(err, ErrInvalidLoginMethod) || errors.Is(err, ErrNoItemVariants) || + errors.Is(err, ErrInvalidQuantityInStock) || errors.Is(err, ErrInvalidGSTPercentage) { return http.StatusBadRequest } |