File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import AsyncIncreamentalUseCase from "../usecase/AsyncIncreamentalUseCase"
55import IncrementalCounterUseCase from "../usecase/IncrementalCounterUseCase"
66import DecrementalCounterUseCase from "../usecase/DecrementalCounterUseCase"
77import UpDownCounterUseCase from "../usecase/UpDownCounterUseCase"
8+ import ThrowErrorUseCase from "../usecase/ThrowErrorUseCase"
89import { Context } from "almin"
910import CounterState from "../store/CounterState"
1011export default class CounterComponent extends React . Component {
@@ -32,6 +33,10 @@ export default class CounterComponent extends React.Component {
3233 const both = ( ) => {
3334 context . useCase ( new UpDownCounterUseCase ( ) ) . execute ( ) ;
3435 } ;
36+
37+ const throwError = ( ) => {
38+ context . useCase ( new ThrowErrorUseCase ( ) ) . execute ( ) ;
39+ } ;
3540 const counterState = this . props . counterState ;
3641
3742 return (
@@ -41,6 +46,7 @@ export default class CounterComponent extends React.Component {
4146 < button onClick = { decrement } > Counter --</ button >
4247 < button onClick = { both } > Counter +-</ button >
4348 < button onClick = { parallel } > Counter +- in parallel</ button >
49+ < button onClick = { throwError } > Throw Error</ button >
4450 < p >
4551 Count: { counterState . count }
4652 </ p >
Original file line number Diff line number Diff line change 1+ // MIT © 2017 azu
2+ "use strict" ;
3+ import { UseCase } from "almin" ;
4+ export default class ThrowErrorUseCase extends UseCase {
5+ execute ( ) {
6+ this . throwError ( new Error ( "ERR!" ) ) ;
7+ }
8+ }
Original file line number Diff line number Diff line change @@ -70,6 +70,9 @@ module.exports = class AlminDevTools {
7070 this . devTools . send ( `UseCase:${ meta . useCase . name } ` , this . alminContext . getState ( ) ) ;
7171 } ) ;
7272 } ) ;
73+ this . alminContext . onErrorDispatch ( ( payload , meta ) => {
74+ this . devTools . error ( payload . error . message ) ;
75+ } ) ;
7376 }
7477
7578 /**
You can’t perform that action at this time.
0 commit comments