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

actml

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

actml - npm Package Compare versions

Comparing version 0.15.2 to 0.16.0

2

lib/elements/Element.js

@@ -24,2 +24,3 @@ 'use strict';

debug: false,
isErrorHandler: false,

@@ -50,2 +51,3 @@ mergeToProps: function mergeToProps(additionalProps) {

this.props.onError.mergeToProps({ error: error });
this.props.onError.isErrorHandler = true;
return this.props.onError;

@@ -52,0 +54,0 @@ }

2

lib/elements/redux/Subscribe.js

@@ -20,3 +20,3 @@ 'use strict';

if (action.type === type) {
children({ action: action });
children(action);
}

@@ -23,0 +23,0 @@ });

@@ -20,3 +20,3 @@ 'use strict';

if (action.type === type) {
children({ action: action });
children(action);
removeListener();

@@ -23,0 +23,0 @@ }

@@ -47,3 +47,3 @@ 'use strict';

if (error.toString().match(/children is not a function/)) {
return new Error('You are trying to use "children" prop as a function in <' + sourceElement + '> but it is not. Did you forget to wrap its children in round brackets. Like for example <' + sourceElement + '>(<Child />)</' + sourceElement + '>?');
return new Error('You are trying to use "children" prop as a function in <' + sourceElement + '> but it is not. Did you forget to wrap its children into parentheses. Like for example <' + sourceElement + '>(<Child />)</' + sourceElement + '>?');
}

@@ -116,3 +116,3 @@ return error;

if (Handler) {
if (Handler && !element.isErrorHandler) {
_this.add(Handler, element, continueFlow);

@@ -119,0 +119,0 @@ } else {

{
"name": "actml",
"version": "0.15.2",
"version": "0.16.0",
"description": "Like jsx but for your business logic",

@@ -5,0 +5,0 @@ "main": "lib",

@@ -487,8 +487,7 @@ ![ActML](assets/logo.jpg)

};
const App = function() {};
run(
<App>
<A>
<Problem />
</App>
</A>
).catch(error => {

@@ -506,13 +505,13 @@ console.log('Ops, an error: ', error.message);

};
const App = function() {};
const HandleError = ({ error }) => console.log(error.message); // logs "iDontExist is not defined"
const HandleError = ({ error }) => console.log('Ops!');
run(
<App>
<A>
<Problem onError={ <HandleError /> } />
</App>
</A>
);
// outputs: Ops!
```
ActML stops the execution of the current logic. However, if our handler returns `true` it continues. For example:
If we are handling the error the ActML processor assumes that we know what we are doing and does not stop the execution. For example:

@@ -523,44 +522,16 @@ ```js

};
const App = function() {};
const HandleError = () => true;
const AfterError = () => console.log('I am still here :)');
const Foo = () => console.log('I am still here');
const HandleError = ({ error }) => console.log('Ops!');
run(
<App exports='answer'>
<Problem onError={ <HandleError /> } />
<AfterError />
</App>
<A>
<Problem onError={<HandleError />} />
<Foo />
</A>
);
// outputs "I am still here :)" even tho there's an error
// outputs "Ops!" followed by "I am still here"
```
And by stopping the execution we mean only the current branch. For example:
And of course we may still stop the processing by throwing error from inside our handler.
```js
const Problem = function() {
return iDontExist;
};
const App = function() {};
const Wrapper = function() {};
const HandleError = () => {};
const Z = () => console.log('Z');
const B = () => console.log('B');
const C = () => console.log('C');
await run(
<App exports='answer'>
<Wrapper onError={ <HandleError /> }>
<Problem/>
<Z />
</Wrapper>
<Wrapper>
<B />
<C />
</Wrapper>
</App>
);
```
We will see `B` followed by `C` but not `Z` because there's an error at that level. Here is a [Codesandbox](https://codesandbox.io/s/qlpwp2nn06) with an example.
## Examples

@@ -567,0 +538,0 @@

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