function addOne(x) {
    if (!Number.isInteger(x)) {
        throw new TypeError('引数が、整数ではありません');
    }
    return x + 1;
}

addOne('foo');



class NotIntegerError extends TypeError {
}

function addOne(x) {
    if (!Number.isInteger(x)) {
        throw new NotIntegerError('引数が、整数ではありません');
    }
    return x + 1;
}

addOne('foo');



class NotIntegerError extends TypeError {
    constructor(message) {
        super(message);
        this.name = "NotIntegerError";
    }
}



try {
    addOne('');
} catch (e) {
    console.log(e);
}



try {
    addOne('');
} catch (e) {
    if (e instanceof NotIntegerError) {
        
    } else {
        
    }
}



try {
    addOne('');
} catch (e) {
}



function callAddOne(x) {
    try {
        addOne(x);
    } catch (e) {
        if (e instanceof NotIntegerError) {
            
        } else {
            throw e;
        }
    }
}



function callAddOne(x) {
    try {
        addOne(x);
    } catch (e) {
        if (e instanceof NotIntegerError) {
            
        } else {
            return NaN;
        }
    }
}



function callAddOne(x) {
    addOne(x);
}



def add_one(x):
    if (type(x) is not int):
        raise TypeError("引数が、整数ではありません")
    return x + 1


add_one("foo")



class NotIntegerError(TypeError):
    pass


def add_one(x):
    if (type(x) is not int):
        raise NotIntegerError("引数が、整数ではありません")
    return x + 1


add_one("foo")



try:
    add_one("foo")
except Exception as e:
    print(e)

