I have the following SDE and I would like to check if the solution , i.e. the explicit form for $X_t$ that I gave is either wrong or false. $$dX_t = \frac{e^t-X_t}{t-2}dt + tdW_t$$
with $t \in [0,2] $ and $X_0 = 0$ and $W_t$ is a brownian motion.
I supppose it is a modified SDE of Hull-White but with a coefficient on $X_t$ depending on time.
For my own readability I wrote the equation as follow, hoping it would be easy to plug the coefficients of each term in the solution for the general Linear SDE : $$ dX_t =\bigg( \frac{-X_t}{t-2} + \frac{e^t}{t-2} \bigg)dt + tdW_t$$
I tried to start with the process $Y_t = e^{\int_0^t \frac{-1}{s-2}ds}X_t$ and apply Ito to it. Solving the integral in the exponential I get: $$Y_t =e^{-log(|2-t|)+log(|2|)}X_t = \frac{2}{2-t}X_t \tag{1}$$
I calculate its differential by applying Ito's lemma: $dY_t = \bigg( \frac{\partial f}{\partial t} + \frac{\partial f}{\partial x} \mu_X+ \frac{1}{2}\frac{\partial ^2f}{\partial x^2}\sigma^2_X \bigg)dt + \bigg( \frac{\partial f}{\partial x}\sigma_X \bigg)$
with $ \mu_X$ and $ \sigma_X$ defined in : $dX_t = \mu_X dt + \sigma_X dW_t $
From the relation $(1)$ the partial derivatives are : $\frac{\partial f}{\partial t} = \frac{-2}{(2-t)^2}, \frac{\partial f}{\partial x} = \frac{2}{2-t} , \frac{\partial ^2f}{\partial x^2} = 0$
Finally :
$$dY_t = \frac{-2}{(2-t)^2} X_tdt + \frac{2}{2-t} \bigg[ \big( \frac{-X_t}{t-2} + \frac{e^{t}}{t-2} \big)dt \bigg]+ \frac{2}{2-t}tdW_t$$
The terms in $X_t$ simplify each other and so integrating both LHS and RHS is feasible : $$Y_t - Y_0 = \int_0^t \frac{2}{2-s} \frac{e^{s}}{s-2}ds + \int_0^t \frac{2}{2-s}sdW_s$$
From $ (1) $ and the initial $X_0 = 0$ we know that $Y_0 = 0$ and replacing $Y_t$ by its value in $(1)$ : $$X_t = \int_0^t \frac{2}{2-s} \frac{e^{s}}{s-2}ds + \int_0^t \frac{2}{2-s}sdW_s$$
And now I don't know what I can do to see if it is a correct solution. N.B. : Also I feel like I miss some perspective here, so any comments on form or context is still appreciated.
Suppose that $(X_t)_{t \geq 0}$ is a solution to the SDE
$$dX_t = \frac{e^t-X_t}{t-2} \, dt+ t \, dW_t.$$
then
$$Y_t := X_t - \int_0^t s \, dW_s = \int_0^t \frac{e^s-X_s}{s-2} \, ds$$
is a solution to the ordinary differential equation
$$dY_t = - \frac{Y_t}{t-2} \, dt + \underbrace{\frac{e^t-\int_0^t s \, dW_s}{t-2}}_{=:f(t)} \, dt \tag{1}$$
The solution to the associated homogeneous equation
$$dz_t = - \frac{z_t}{t-2}$$
is given by
$$z_t = \frac{c}{t-2}.$$
To obtain a solution to the inhomogeneous equation we use the variation of constants approach, i.e. we make the ansatz
$$Y_t = \frac{c(t)}{t-2} \tag{2}$$
and find
$$Y'(t) = - \frac{Y_t}{t-2}+ \frac{c'(t)}{t-2}.$$
Comparing this with $(1)$ we find that
$$c'(t) = f(t) = \frac{1}{t-2} \left( e^t- \int_0^t s \, dW_s \right),$$
and so
$$c(t) = \int_0^t \frac{1}{s-2} \left( e^s- \int_0^s r \, dW_r \right) \, ds.$$
Thus, by $(2)$,
$$Y_t = \frac{1}{t-2} \int_0^t \frac{1}{s-2} \left( e^s- \int_0^s r \, dW_r \right) \, ds$$
implying
$$X_t = Y_t + \int_0^t s \, dW_s = \frac{1}{t-2} \int_0^t \frac{1}{s-2} \left( e^s- \int_0^s r \, dW_r \right) \, ds + \int_0^t s \, dW_s. \tag{3}$$
Remark: By Itô's formula, we have
$$tW_t = \int_0^t s \, dW_s + \int_0^t W_s \, ds,$$
i.e.
$$\int_0^t s \, dW_s = t W_t - \int_0^t W_s \, ds.$$
This means that we can actually get rid of the stochastic integral in $(3)$.