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

Remove requirement of call execute #6

Open
Alex009 opened this issue Aug 6, 2020 · 1 comment
Open

Remove requirement of call execute #6

Alex009 opened this issue Aug 6, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@Alex009
Copy link
Member

Alex009 commented Aug 6, 2020

// now
    viewModelScope.launch {
        exceptionHandler.handle {
            serverRequest()
        }.catch<IllegalArgumentException> {     // Specifying a specific exception class
            // Some custom handler code
            false                               // true - cancels ErrorPresenter; false - allows execution of ErrorsPresenter
        }.execute()                             // Starts code execution in `handle` lambda
    }
    // suggestion
    viewModelScope.launch {
        isLoading = true
        val result = exceptionHandler {
        	action {
                serverRequest()
	        }
    	    catch<IllegalAccessException> { exc ->
        	    // Some custom handler code
            	false                               // true - cancels ErrorPresenter; false - allows execution of ErrorsPresenter
	        }
    	    catch<IllegalArgumentException> { exc ->
        	    // Some custom handler code
	            false                               // true - cancels ErrorPresenter; false - allows execution of ErrorsPresenter
	        }
    	    finally {
        	    isLoading = false
	        }
	    }
    }
@Alex009 Alex009 added the enhancement New feature or request label Aug 6, 2020
@Alex009
Copy link
Member Author

Alex009 commented Aug 6, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant