This was a petition for a writ of habeas corpus. The case was heard upon the petition, as is now the more common practice. At the hearing the petitioner requested the court to make certain rulings, which the court refused to do, and ruled *36instead “ that under the law of Massachusetts, where it is not contended that the conviction is illegal, but only that the sentence imposed is illegal and void, the remedy is not by writ of habeas corpus, but by writ of error,” and refused to grant the petition, and denied the writ.
The petitioner excepted to the ruling of the court, and to its refusal to rule as requested. It is doubtful if exceptions will lie in a hearing upon a petition for the writ, or, after the writ has issued, in a hearing upon the question of remanding or discharging the party. King’s case, 161 Mass. 46. Wyeth v. Richardson, 10 Gray, 240. In the latter case, it is said that “the allowance of exceptions would be inconsistent with the object of the writ. The consequence of allowing exceptions must be, either that all further proceedings be stayed, which would be wholly inconsistent with the purpose of the writ; or that the exceptions must be held frivolous, and judgment rendered non obstante for the discharge of the party, in which case the exceptions would be unavailing. The allowance of the exceptions being thus inconsistent with the very purpose of the writ, the conclusion must be that the exceptions do not lie.” Reference is made to this and other cases in King’s case, supra, and it is there said: “ In recent cases questions of law arising on habeas corpus have been reserved, or reported, or adjourned into the full court by a single justice.”
But, assuming without deciding that the case is properly before us, we find no error in the ruling of the presiding justice, or in his refusals to rule as requested. All of the requests were addressed to matters relating to the sentence. Hone of them involved matters affecting the jurisdiction of the court over the offence, or the regularity of the trial, even granting that there might be such irregularity as could be availed of on a petition for a writ of habeas corpus. The general rule is that where the court has jurisdiction, and errs merely in regard to the punishment, relief will not be granted by habeas corpus, but that the remedy is by a writ of error, in which the mistake can be corrected and such sentence pronounced as should have been imposed. Riley’s case, 2 Pick. 165,172. Sennott’s case, 146 Mass. 489. Stalker, petitioner, 167 Mass. 11. Ex parte Bigelow, 113 U. S. 328. In re Belt, 159 U. S. 95.
In exceptional cases relief may be granted by habeas corpus, or *37questions of constitutionality considered. Feeley’s ease, 12 Cush. 598. Plumley’s case, 156 Mass. 236. We discover nothing in this case which takes it out of the general rule. Without meaning to intimate thereby that the case is properly before us on exceptions, we think the entry must be,
Exceptions overruled.