In a large frying pan or skillet, heat the olive oil over medium heat and cook the onions until they are just about translucent, about 3 minutes.
Add the garlic and cook until fragrant, about 2 minutes.
Stir in the chili powder, cumin powder, and sugar. Cook until fragrant, about 2 minutes.
Stir in the tomato sauce and chicken stock. Bring to a boil and then reduce to a simmer. Simmer for about 15 - 20 minutes or until the sauce is a rich dark red.
Squeeze in the juice of half a lime.
Use in your favorite enchilada recipe.