Skip to content

Commit 6c16dd9

Browse files
committed
refactor(index): do not export exceptions in index
1 parent eb091c3 commit 6c16dd9

File tree

5 files changed

+9
-20
lines changed

5 files changed

+9
-20
lines changed

index.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,3 @@ export * from '#src/Path'
2424
export * from '#src/Route'
2525
export * from '#src/String'
2626
export * from '#src/Uuid'
27-
28-
// Exceptions
29-
export * from '#src/Exceptions/ConfigNotNormalizedException'
30-
export * from '#src/Exceptions/InvalidNumberException'
31-
export * from '#src/Exceptions/InvalidUuidException'
32-
export * from '#src/Exceptions/NodeExecException'
33-
export * from '#src/Exceptions/NotFoundFileException'
34-
export * from '#src/Exceptions/NotFoundFolderException'
35-
export * from '#src/Exceptions/OrdinalNanException'
36-
export * from '#src/Exceptions/RecursiveConfigException'
37-
export * from '#src/Exceptions/RouteMatchException'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@secjs/utils",
3-
"version": "1.8.6",
3+
"version": "1.8.7",
44
"description": "Utils functions and classes for Node.js",
55
"license": "MIT",
66
"author": "João Lenon <lenon@athenna.io>",

src/Exceptions/NodeExecException.js renamed to src/Exceptions/NodeCommandException.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
import { Exception } from '#src/Exception'
1111

12-
export class NodeExecException extends Exception {
12+
export class NodeCommandException extends Exception {
1313
/**
14-
* Creates a new instance of NodeExecException.
14+
* Creates a new instance of NodeCommandException.
1515
*
1616
* @param {string} command
1717
* @param {string?} stdout
1818
* @param {string?} stderr
19-
* @return {NodeExecException}
19+
* @return {NodeCommandException}
2020
*/
2121
constructor(command, stdout, stderr) {
2222
const content = `Error has occurred when executing the command "${command}"`

src/Exec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { exec as childProcessExec } from 'node:child_process'
1515

1616
import { File } from '#src/File'
1717
import { Options } from '#src/Options'
18-
import { NodeExecException } from '#src/Exceptions/NodeExecException'
18+
import { NodeCommandException } from '#src/Exceptions/NodeCommandException'
1919

2020
const exec = promisify(childProcessExec)
2121

@@ -38,7 +38,7 @@ export class Exec {
3838
* @param {{
3939
* ignoreErrors?: boolean
4040
* }?} options
41-
* @throws {NodeExecException}
41+
* @throws {NodeCommandException}
4242
* @return {Promise<{ stdout: string, stderr: string }>}
4343
*/
4444
static async command(command, options) {
@@ -55,7 +55,7 @@ export class Exec {
5555
return { stdout: error.stdout, stderr: error.stderr }
5656
}
5757

58-
throw new NodeExecException(command, error.stdout, error.stderr)
58+
throw new NodeCommandException(command, error.stdout, error.stderr)
5959
}
6060
}
6161

tests/Unit/ExecTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import { Exec } from '#src/Exec'
1111
import { Path } from '#src/Path'
1212
import { File } from '#src/File'
13-
import { NodeExecException } from '#src/Exceptions/NodeExecException'
1413
import { Folder } from '#src/Folder'
14+
import { NodeCommandException } from '#src/Exceptions/NodeCommandException'
1515

1616
describe('\n ExecTest', () => {
1717
it('should be able to sleep the code for some ms', async () => {
@@ -27,7 +27,7 @@ describe('\n ExecTest', () => {
2727
it('should throw an node exec exception when command fails', async () => {
2828
const useCase = async () => await Exec.command('echo "error thrown" && exit 255')
2929

30-
await expect(useCase).rejects.toThrow(NodeExecException)
30+
await expect(useCase).rejects.toThrow(NodeCommandException)
3131
})
3232

3333
it('should be able to execute a command that throws errors and ignore it', async () => {

0 commit comments

Comments
 (0)