ソースコード
using Firebase;
using Firebase.Auth;
namespace Kogane
{
public static class FirebaseExceptionExtensionMethods
{
public static AuthError GetAuthError( this FirebaseException self )
{
return ( AuthError )self.ErrorCode;
}
}
}
使用例
using System;
using System.Linq;
using Firebase;
using Firebase.Auth;
using Kogane;
using UnityEngine;
public class Example : MonoBehaviour
{
private async void Start()
{
try
{
var auth = FirebaseAuth.DefaultInstance;
var user = await auth.CreateUserWithEmailAndPasswordAsync( "", "" );
}
catch ( AggregateException e ) when ( e.Flatten().InnerExceptions.Any( x => x is FirebaseException ) )
{
foreach ( var firebaseException in e.Flatten().InnerExceptions.OfType<FirebaseException>() )
{
Debug.LogError( firebaseException.GetAuthError() );
}
}
}
}