From ea7560da6bf3009cde151acd98e9ba3a074e55aa Mon Sep 17 00:00:00 2001 From: Sergey Bronnikov Date: Sun, 4 Jul 2021 01:20:15 +0300 Subject: [PATCH] Unify error names We use `errors.new_class()` that declares error names. Error names usually has a form "Error", but some error codes has a form "". This patch makes all error names conform to the first form. --- CHANGELOG.md | 4 ++++ crud/borders.lua | 2 +- crud/common/call.lua | 2 +- crud/delete.lua | 2 +- crud/get.lua | 2 +- crud/insert.lua | 2 +- crud/replace.lua | 2 +- crud/truncate.lua | 2 +- crud/update.lua | 2 +- 9 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cf0ca37..04b9ba60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed + +* Names of errors generated by CRUD operations have been unified. + ### Added * `crud.len()` function to calculate the number of tuples diff --git a/crud/borders.lua b/crud/borders.lua index d7053a8e..1a54f900 100644 --- a/crud/borders.lua +++ b/crud/borders.lua @@ -9,7 +9,7 @@ local schema = require('crud.common.schema') local has_keydef, Keydef = pcall(require, 'crud.compare.keydef') local select_comparators = require('crud.compare.comparators') -local BorderError = errors.new_class('Border', {capture_stack = false}) +local BorderError = errors.new_class('BorderError', {capture_stack = false}) local borders = {} diff --git a/crud/common/call.lua b/crud/common/call.lua index 75e00d14..c5b94c98 100644 --- a/crud/common/call.lua +++ b/crud/common/call.lua @@ -5,7 +5,7 @@ local dev_checks = require('crud.common.dev_checks') local utils = require('crud.common.utils') local fiber_clock = require('fiber').clock -local CallError = errors.new_class('Call') +local CallError = errors.new_class('CallError') local NotInitializedError = errors.new_class('NotInitialized') local call = {} diff --git a/crud/delete.lua b/crud/delete.lua index 8004701d..e0aaca07 100644 --- a/crud/delete.lua +++ b/crud/delete.lua @@ -8,7 +8,7 @@ local sharding = require('crud.common.sharding') local dev_checks = require('crud.common.dev_checks') local schema = require('crud.common.schema') -local DeleteError = errors.new_class('Delete', {capture_stack = false}) +local DeleteError = errors.new_class('DeleteError', {capture_stack = false}) local delete = {} diff --git a/crud/get.lua b/crud/get.lua index f8c0f39f..e6342f00 100644 --- a/crud/get.lua +++ b/crud/get.lua @@ -8,7 +8,7 @@ local sharding = require('crud.common.sharding') local dev_checks = require('crud.common.dev_checks') local schema = require('crud.common.schema') -local GetError = errors.new_class('Get', {capture_stack = false}) +local GetError = errors.new_class('GetError', {capture_stack = false}) local get = {} diff --git a/crud/insert.lua b/crud/insert.lua index b417de65..17b1a41c 100644 --- a/crud/insert.lua +++ b/crud/insert.lua @@ -8,7 +8,7 @@ local sharding = require('crud.common.sharding') local dev_checks = require('crud.common.dev_checks') local schema = require('crud.common.schema') -local InsertError = errors.new_class('Insert', {capture_stack = false}) +local InsertError = errors.new_class('InsertError', {capture_stack = false}) local insert = {} diff --git a/crud/replace.lua b/crud/replace.lua index 338a1219..26d57217 100644 --- a/crud/replace.lua +++ b/crud/replace.lua @@ -8,7 +8,7 @@ local sharding = require('crud.common.sharding') local dev_checks = require('crud.common.dev_checks') local schema = require('crud.common.schema') -local ReplaceError = errors.new_class('Replace', { capture_stack = false }) +local ReplaceError = errors.new_class('ReplaceError', { capture_stack = false }) local replace = {} diff --git a/crud/truncate.lua b/crud/truncate.lua index 1ce87441..6aa7f22d 100644 --- a/crud/truncate.lua +++ b/crud/truncate.lua @@ -5,7 +5,7 @@ local vshard = require('vshard') local dev_checks = require('crud.common.dev_checks') local call = require('crud.common.call') -local TruncateError = errors.new_class('Truncate', {capture_stack = false}) +local TruncateError = errors.new_class('TruncateError', {capture_stack = false}) local truncate = {} diff --git a/crud/update.lua b/crud/update.lua index 8b22d262..e107e3bd 100644 --- a/crud/update.lua +++ b/crud/update.lua @@ -8,7 +8,7 @@ local sharding = require('crud.common.sharding') local dev_checks = require('crud.common.dev_checks') local schema = require('crud.common.schema') -local UpdateError = errors.new_class('Update', {capture_stack = false}) +local UpdateError = errors.new_class('UpdateError', {capture_stack = false}) local update = {}