Srimad Bhagavatam Canto 01, Chapter 18, Text 31

SB 1.18.31

esa kim nibhrtasesa-
karano militeksanah
mrsa-samadhir ahosvit
kim nu syat ksatra-bandhubhih
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
Upon returning, he began to contemplate and argue within himself whether the sage had actually been in meditation, with senses concentrated and eyes closed, or whether he had just been feigning trance just to avoid receiving a lower ksatriya.
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
The King, being a devotee of the Lord, did not approve of his own action, and thus he began to wonder whether the sage was really in a trance or was just pretending in order to avoid receiving the King, who was a ksatriya and therefore lower in rank. Repentance comes in the mind of a good soul as soon as he commits something wrong. Srila Visvanatha Cakravarti Thakura and Srila Jiva Gosvami do not believe that the King’s action was due to his past misdeeds. The arrangement was so made by the Lord just to call the King back home, back to Godhead.
According to Srila Visvanatha Cakravarti, the plan was made by the will of the Lord, and by the will of the Lord the situation of frustration was created. The plan was that for his so-called misdeed the King could be cursed by an inexperienced brahmana boy infected by the influence of Kali, and thus the King would leave his hearth and home for good. His connections with Srila Sukadeva Gosvami would enable the presentation of the great Srimad-Bhagavatam, which is considered to be the book incarnation of the Lord. This book incarnation of the Lord gives much fascinating information of the transcendental pastimes of the Lord, like His rasa-lila with the spiritual cowherd damsels of Vrajabhumi. This specific pastime of the Lord has a special significance because anyone who properly learns about this particular pastime of the Lord will certainly be dissuaded from mundane sex desire and be placed on the path of sublime devotional service to the Lord. The pure devotee’s mundane frustration is meant to elevate the devotee to a higher transcendental position. By placing Arjuna and the Pandavas in frustration due to the intrigue of their cousin-brothers, the prelude of the Battle of Kuruksetra was created by the Lord. This was to incarnate the sound representative of the Lord, Bhagavad-gita. So by placing King Pariksit in an awkward position, the incarnation of Srimad-Bhagavatam was created by the will of the Lord. Being distressed by hunger and thirst was only a show, because the King endured much, even in the womb of his mother. He was never disturbed by the glaring heat of the brahmastra released by Asvatthama. The King’s distressed condition was certainly unprecedented. The devotees like Maharaja Pariksit are powerful enough to forbear such distresses, by the will of the Lord, and they are never disturbed. The situation, in this case, was therefore all planned by the Lord.
Srimad Bhagavatam Canto 01, Chapter 18, Text 30
Srimad Bhagavatam Canto 01, Chapter 18, Text 32