New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wmfs/statebox

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wmfs/statebox - npm Package Compare versions

Comparing version 1.12.0 to 1.13.0

test/fixtures/module-resources/Exception.js

17

CHANGELOG.md

@@ -0,1 +1,18 @@

# [1.13.0](https://github.com/wmfs/statebox/compare/v1.12.0...v1.13.0) (2018-09-12)
### ✨ Features
* Improve sendTaskFailure handling ([30e730a](https://github.com/wmfs/statebox/commit/30e730a))
### 🛠 Builds
* **deps-dev:** update semantic-release requirement ([623c8ef](https://github.com/wmfs/statebox/commit/623c8ef))
### 💎 Styles
* Flipped order of failExecution parameters so they are more natural ([c48bb19](https://github.com/wmfs/statebox/commit/c48bb19))
# [1.12.0](https://github.com/wmfs/statebox/compare/v1.11.0...v1.12.0) (2018-09-11)

@@ -2,0 +19,0 @@

52

lib/dao/Dao.js

@@ -52,4 +52,5 @@ const Status = require('../Status')

failExecution (executionDescription, errorMessage, errorCode) {
failExecution (executionDescription, errorInfo) {
const executionName = executionDescription.executionName
const error = errorDetails(errorInfo)

@@ -60,10 +61,6 @@ return this._updateExecution(

execution.status = Status.FAILED
execution.errorCode = errorCode
execution.errorMessage = errorMessage
execution.executionOptions.error = error
execution.errorCode = error.error
execution.errorMessage = error.cause
execution.executionOptions.error = {
error: errorCode,
cause: errorMessage
}
return this._markRelatedBranchesAsFailed(executionDescription.executionOptions.rootExecutionName)

@@ -131,2 +128,41 @@ },

function errorDetails (errorInfo) {
if (isError(errorInfo)) {
errorInfo = {
error: errorInfo.name,
cause: errorInfo
}
} // if ...
const error = {
error: errorInfo.error,
cause: errorInfo.cause
}
if (isHttpError(error.cause)) {
const httpErr = errorInfo.cause
error.cause = httpErr.message
error.statusCode = httpErr.statusCode
error.options = httpErr.options
error.response = httpErr.response
} else if (isError(error.cause)) {
const err = errorInfo.cause
error.cause = err.message
error.stack = err.stack
}
return error
} // errorDetails
function isError (err) {
return err && err.name && err.message && err.stack
}
function isHttpError (err) {
return err &&
err.name === 'StatusCodeError' &&
err.message &&
err.statusCode
}
module.exports = Dao

4

lib/index.js

@@ -173,3 +173,3 @@ 'use strict'

async sendTaskFailure (executionName, options) {
async sendTaskFailure (executionName, errorInfo) {
const executionDescription = await this.options.dao.findExecutionByName(executionName)

@@ -180,3 +180,3 @@

const stateToRun = stateMachine.states[executionDescription.currentStateName]
return stateToRun.runTaskFailure(executionDescription, options)
return stateToRun.runTaskFailure(executionDescription, errorInfo)
} else {

@@ -183,0 +183,0 @@ throw new Error(`Failure has been rejected because execution is not running (executionName='${executionName}')`)

@@ -41,3 +41,3 @@ 'use strict'

async runTaskFailure (executionDescription, options) {
async runTaskFailure (executionDescription, errorInfo) {
const ctx = executionDescription.ctx

@@ -48,3 +48,3 @@ const stateMachine = stateMachines.findStateMachineByName(executionDescription.stateMachineName)

const catchHandler = this.hasCatchHandler(stateDefinition, options.error)
const catchHandler = this.hasCatchHandler(stateDefinition, errorInfo.error)

@@ -64,4 +64,3 @@ if (catchHandler) {

executionDescription,
options.cause,
options.error
errorInfo
)

@@ -87,3 +86,3 @@ return failedExecutionDescription

async processTaskFailure (options, executionName) {
async processTaskFailure (errorInfo, executionName) {
const executionDescription = await this.dao.findExecutionByName(

@@ -95,3 +94,3 @@ executionName

executionDescription,
options
errorInfo
)

@@ -98,0 +97,0 @@

@@ -26,6 +26,6 @@ 'use strict'

sendTaskFailure (options) {
console.error(`sendTaskFailure(${this.executionName}, ${JSON.stringify(options)})`)
debug(`sendTaskFailure(${this.executionName}, ${JSON.stringify(options)})`)
this.task.processTaskFailure(options, this.executionName)
sendTaskFailure (errorInfo) {
console.error(`sendTaskFailure(${this.executionName}, ${JSON.stringify(errorInfo)})`)
debug(`sendTaskFailure(${this.executionName}, ${JSON.stringify(errorInfo)})`)
this.task.processTaskFailure(errorInfo, this.executionName)
}

@@ -32,0 +32,0 @@

@@ -21,5 +21,5 @@ 'use strict'

sendTaskFailure (options) {
sendTaskFailure (errorInfo) {
debug(`sendTaskFailure(${this.executionName})`)
this.task.processTaskFailure(options, this.executionName)
this.task.processTaskFailure(errorInfo, this.executionName)
}

@@ -26,0 +26,0 @@

{
"name": "@wmfs/statebox",
"version": "1.12.0",
"version": "1.13.0",
"description": "Orchestrate Node functions using Amazon States Language",

@@ -39,2 +39,3 @@ "author": "West Midlands Fire Service",

"chai": "4.1.2",
"chai-string": "1.5.0",
"chai-subset": "1.6.0",

@@ -44,6 +45,8 @@ "codecov": "3.1.0",

"cz-conventional-changelog": "2.1.0",
"dirty-chai": "^2.0.1",
"dirty-chai": "2.0.1",
"express": "4.16.3",
"mocha": "5.2.0",
"nyc": "13.0.1",
"semantic-release": "15.9.14",
"request-promise-native": "1.0.5",
"semantic-release": "15.9.15",
"standard": "12.0.1"

@@ -50,0 +53,0 @@ },

@@ -10,3 +10,7 @@ // And export instances

subtract: require('./Subtract'),
exception: require('./Exception'),
httpCantConnect: require('./HttpCantConnect'),
httpNotFound: require('./HttpNotFound'),
failure: require('./Failure'),
failWithError: require('./FailWithError'),
stuttery: require('./Stuttery'),

@@ -13,0 +17,0 @@ ilive: require('./Ilive'),

module.exports = {
formFilling: require('./form-filling.json'),
errorCodeAndErrorObject: require('./error-code-and-error-object.json'),
errorCodeAndMessage: require('./error-code-and-message.json'),
errorException: require('./error-exception.json'),
errorHttpCantConnect: require('./error-http-cant-connect.json'),
errorHttpNotFound: require('./error-http-not-found.json'),
helloWorld: require('./hello-world.json'),

@@ -4,0 +9,0 @@ helloThenWorld: require('./hello-then-world.json'),

/* eslint-env mocha */
'use strict'

@@ -4,0 +3,0 @@ const chai = require('chai')

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc