The maximum likelihood estimator for linear data $y_i = \beta x_i + \epsilon_i$ with i.i.d. normally distributed errors $\epsilon_i \sim \mathcal{N}(0,\sigma^2)$ is ordinary least squares, i.e.
$$\hat{\beta}_{\text{Normal}} = \text{argmin}_\beta \sum_i (y_i-\beta x_i)^2.$$
However, if the errors are Laplace distributed, $\epsilon_i \sim \mathcal{L}(0, b)$, the MLE turns out to be
$$\hat{\beta}_{\text{Laplace}} = \text{argmin}_\beta \sum_i |y_i-\beta x_i|,$$
which is L1 regression. In principle, I don't see anything preventing our errors from following any zero-mean distribution, and deriving an appropriate minimization problem, either analytically or computationally.
However, how can we find the distribution of the errors? For example, suppose we fit an L1 regression to the data and a statistical test confirms the residuals $r_i$ are Laplace distributed. Then we can be reasonably confident that we selected the "right type of regression" (L1 regression rather than, say, OLS). But what if we perform an L1 regression and the residuals $r_i$ don't look Laplace distributed?
In general, is there some sort of procedure for selecting the "best" distribution for $\epsilon_i$, in the sense that when you solve the corresponding minimization problem for $\hat{\beta}$, the residuals $r_i = y_i - \hat{\beta}x_i$ follow the same distribution you initially assumed the errors $\epsilon_i$ would follow?