Skip to content

Remove requirement of call execute #6

@Alex009

Description

@Alex009
// 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
	        }
	    }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions