Let f(x) = 1/(x+2) and g(x)= (x-1)/x.

Simplify and state the domain.

f(g(x))
g(f(x))

f(g) = 1/(g+2) = 1/((x-1)/x + 2) = x/(3x-1)

g(f) = (f-1)/f = 1 - 1/f = 1 - 1/(1/(x+2)) = 1 - (x+2) = -x - 1

As for the domains, since

f(g) = x/(3x-1) the domain ought to be all reals except x = 1/3. However, you must also exclude
x=0, because g(0) is not defined, so f(g(0)) is neither.

g(f) = -x-1, whose domain ought to be all reals, but you have to exclude
x = -2 because f(-2) is not defined, so neither is g(f(-2))

Now, g(0) is not defined, but fortunately there is no value of x which makes f(x) = 0, so we're safe there.