Skip to content
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

Seclude ServerlessError into lib/serverless-error.js #8743

Merged
merged 1 commit into from Jan 11, 2021

Conversation

medikoo
Copy link
Contributor

@medikoo medikoo commented Jan 11, 2021

Attributes to: #8364

Secludes ServerlessError from Serverless internals implementation.

This class should be accessible independently of Serverless, especially after general process error handling was generalized with #8726

@medikoo medikoo self-assigned this Jan 11, 2021
@codecov
Copy link

codecov bot commented Jan 11, 2021

Codecov Report

Merging #8743 (cdc120b) into master (b4fef7d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #8743   +/-   ##
=======================================
  Coverage   87.43%   87.43%           
=======================================
  Files         256      257    +1     
  Lines        9631     9632    +1     
=======================================
+ Hits         8421     8422    +1     
  Misses       1210     1210           
Impacted Files Coverage Δ
lib/Serverless.js 97.19% <100.00%> (ø)
lib/classes/Error.js 95.45% <100.00%> (-0.55%) ⬇️
lib/loadEnv.js 94.11% <100.00%> (ø)
.../compile/events/apiGateway/lib/hack/updateStage.js 95.06% <100.00%> (ø)
...aws/package/compile/events/websockets/lib/stage.js 100.00% <100.00%> (ø)
lib/plugins/aws/utils/resolveCfImportValue.js 62.50% <100.00%> (ø)
lib/plugins/aws/utils/resolveCfRefValue.js 66.66% <100.00%> (ø)
lib/plugins/create/create.js 90.69% <100.00%> (ø)
lib/serverless-error.js 100.00% <100.00%> (ø)
lib/utils/downloadTemplateFromRepo.js 96.63% <100.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4fef7d...cdc120b. Read the comment docs.

@medikoo medikoo requested a review from pgrzesik January 11, 2021 14:58
Copy link
Contributor

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one "general question" comment only

@@ -14,7 +14,7 @@ const Utils = require('./classes/Utils');
const Service = require('./classes/Service');
const Variables = require('./classes/Variables');
const ConfigSchemaHandler = require('./classes/ConfigSchemaHandler');
const ServerlessError = require('./classes/Error').ServerlessError;
const ServerlessError = require('./serverless-error');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a general question about naming patterns for utilities/modules like that. It seems like currently we mostly have camelCase where I've also noticed some utils with kebab-case. Which one is preferred?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good question, I forgot to discuss that with you. Situation is as follows:

  • serverless project since beginning practiced camelCase
  • In Node.js community more common was to practise kebab-case. Afaik to avoid confusion between case-sensitive and case insensitive file systems, e.g. now require'ing serverless/lib/serverless.js will work on case insensitive systems but will fail on case sensitive systems (with kabab-case it's less likely someone will mix filename casing in require)
  • Some other projects in this organization practice kebab-case
  • As kebab-case felt to me as more natural and safer choice, at some point I decided to shift serverless gradually towards kabab-case (I didn't want to imply rename of all modules to avoid eventual breaking changes - but I think with new major we may simply rename all modules to it, to ensure same convention everywhere)

I don't have very strong opinion on that. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for detailed explanation, it makes sense to me 👍

@medikoo medikoo requested a review from pgrzesik January 11, 2021 16:37
@medikoo medikoo merged commit 87790e5 into master Jan 11, 2021
@medikoo medikoo deleted the 1011-seclude-serverless-error branch January 11, 2021 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants