concept partial function in category kotlin

This is an excerpt from Manning's book The Joy of Kotlin.
A relationship that isn’t defined for all elements of the domain but that fulfills the rest of the requirement is often called a partial function. And, by analogy, a nonpartial function is sometimes called a total function, which is redundant. Strictly speaking, a true function is always total, and a partial function is not a function. But it’s useful to know the vocabulary used by many programmers.
The relation
predecessor(x)is a partial function onN(the set of positive integers plus 0), but it’s a total function onN*, which is the set of positive integers without 0, and its codomain isN. Partial functions are important in programming because many bugs are the result of using a partial function as if it were a total function. For example, the relationf(x) = 1/xis a partial function from N to Q (the rational numbers) because it isn’t defined for 0. It’s a total function from N* to Q, but it’s also a total function from N to (Q plus error). By adding an element to the codomain (the error condition), you can transform the partial function into a total one. But to do this, the function needs a way to return an error. Can you see an analogy with computer programs? Later in this book, you’ll see that turning partial functions into total ones is an important part of safe programming.