I use LangExt library and i have the case of no user exists with UserId 1.
public async Task<Option<UserViewModel> GetUser()
=> await GetUser(1)
.MapAsync(this.alterName)
.MapAsync(this.alterCountry)
.MapAsync(this.applyMoreChange)
.Map(this.mapper.map<ViewModel>);
since no user exists for userId 1, the GetUser(1)
returns Option<None>
and the remaining code fails with the exception
LangExt.ValueIsNoneException : Value is None.
at languageExt.OptionAsyncAwaiter`1.GetResult()
How to handle this case.? and to make sure the mapAsync and map chaining execute only if option is some user and not none.