Create a Result class and return that instead...
public class Result
{
public bool Success {get;set;}
public string AccessToken {get;set;}
public string ErrorMessage {get;set;}
}
public Result GetFacebookToken()
{
Result result = new Result();
try{
result.AccessToken = "FACEBOOK TOKEN";
result.Success = true;
}
catch(Exception ex){
result.ErrorMessage = ex.Message;
result.Success = false;
}
return result;
}
Then you can call this code like...
Result result = GetFacebookToken();
if(result.Success)
{
//do something with result.AccessToken
}
else
{
//do something with result.ErrorMessage
}