import {UserInterface} from "./Classes/User"

export class ErrorHandler {

    public static userHandler (input: any) {

        if (typeof input.name !== "string")
            throw new Error("Invalid user name");
        
        if (typeof input.email !== "string")
            throw new Error("Invalid user email");

        const newUser: UserInterface = {
            userName: input.name,
            userEmail: input.email
        }

        return newUser;
    }
}