Per page 444 of the Adventurer's Guide, the trigger would go off prior to rolling damage by the enemy, potentially allowing for the player to counter-attack and deliver their damage before they are damaged themselves.
This is also consistent with the a5e.tools website:
a5e.tools
Which defines making an attack as the following:
Dealing damage is covered in a follow-up section and comes after making the attack and as you can see in point #3 is a consequence of hitting with an attack. (Page 446).
This is also thematically consistent, since an arcane fencer type character's riposte would be expected to deflect and counter attack instead of standing there and exchanging blows like a Berzerker/Barbarian.